I am deleting bulk identities using refreshrule so that i can run in partition , however we are getting lazyinitalization exception : no procy session .I belive this is because the identity is fetched directly as the input from refresh task and deleted
Terminator t = new terminator(context);
terminator.deleteObject(identity):
Anything we can do to overcome lazy initialization error
The LazyInitializationException can occur in several scenarios, such as when you attempt to save a complete object and pass it to another part of your code, when there is an index mismatch, or due to issues with full-text search. These errors are common if you are not retrieving objects properly in your rules. Please share your code or more details.
QueryOptions qo = new QueryOptions();
qo.addFilter(Filter.eq(“name”, identity.getName()));
qo.setCloneResults(true); // Ensures result is detached from Hibernate session to avoid LazyInitializationException
Iterator iter = context.search(Identity.class, qo);
Hi @sureshbommareddy98 As per my understanding, refresh task locks the identity during its execution and release it when the execution is over. So I suggest you to use rule runner task instead of refresh rule.