org.hibernate.LazyInitializationException

failed to lazily initialize a collection of role: com.test.hibernate.ChildEntity.parents, no session or session was closed

Solutions on the web712

  • via Spring JIRA by Siarhei Sakovich, 1 year ago
    failed to lazily initialize a collection of role: com.test.hibernate.ChildEntity.parents, no session or session was closed
  • via Spring JIRA by Siarhei Sakovich, 1 year ago
    failed to lazily initialize a collection of role: com.test.hibernate.ChildEntity.parents, no session or session was closed
  • failed to lazily initialize a collection of role: com.foo.avp.model.ChannelGroup.channels, no session or session was closed
  • Stack trace

    • org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.test.hibernate.ChildEntity.parents, no session or session was closed at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380) at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372) at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:119) at org.hibernate.collection.PersistentSet.size(PersistentSet.java:162) at org.hibernate.search.engine.DocumentBuilderContainedEntity.processContainedInInstances(DocumentBuilderContainedEntity.java:644) at org.hibernate.search.engine.DocumentBuilderContainedEntity.addWorkToQueue(DocumentBuilderContainedEntity.java:612) at org.hibernate.search.backend.impl.BatchedQueueingProcessor.addWorkToBuilderQueue(BatchedQueueingProcessor.java:270) at org.hibernate.search.backend.impl.BatchedQueueingProcessor.processWorkByLayer(BatchedQueueingProcessor.java:248) at org.hibernate.search.backend.impl.BatchedQueueingProcessor.prepareWorks(BatchedQueueingProcessor.java:147) at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.beforeCompletion(PostTransactionWorkQueueSynchronization.java:70) at org.hibernate.search.backend.impl.EventSourceTransactionContext$DelegateToSynchronizationOnBeforeTx.doBeforeTransactionCompletion(EventSourceTransactionContext.java:144) at org.hibernate.engine.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:530) at org.hibernate.engine.ActionQueue.beforeTransactionCompletion(ActionQueue.java:211) at org.hibernate.impl.SessionImpl.beforeTransactionCompletion(SessionImpl.java:563) at org.hibernate.jdbc.JDBCContext.beforeTransactionCompletion(JDBCContext.java:229) at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:96) at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101) at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:271) at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:89) at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:176) at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1396) at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:138) at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1009) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:374) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621) at com.test.hibernate.TestService$$EnhancerByCGLIB$$f6772efb.update(<generated>) at com.test.hibernate.TestHb.testHb(TestHb.java:26)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    Once, 11 months ago
    2 times, 8 months ago
    Unknown user
    Once, 1 year ago
    Unknown user
    Once, 4 months ago
    2 times, 4 months ago
    9 more bugmates