HHH000260: Exception calling user Synchronization - hibernate update indexes

Description

HHH000260: Exception calling user Synchronization [org.hibernate.search.backend.impl.EventSourceTransactionContext$BeforeCommitSynchronizationDelegator@b4884752] : org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.myapp.loan.LoanApplication.subloans, could not initialize proxy - the owning Session was closed>

Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.myapp.entities.LoanApplication.subloans, could not initialize proxy - the owning Session was closed

Below is the code line causing this issue.

org.hibernate.search.jpa.FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search
.getFullTextEntityManager(entityManager);

fullTextEntityManager.index(loanApplication);

Session is marked as closed which doesn't allow the entity to update the indexes. Please see the attached testcase.

Below is the link to pull request.

https://github.com/hibernate/hibernate-orm/pull/1969

Update AbstractLazyInitializer.java to fix below issue for setting index from search in version hibernate-core 5.2.8

// Old Code

if ( session.isClosed() ) {
throw new SessionException(
"Session is closed. The read-only/modifiable setting is only accessible when the proxy is associated with an open session."
);
}

// Updated Code

if ( !session.isOpenOrWaitingForAutoClose() ) {
throw new SessionException(
"Session is closed. The read-only/modifiable setting is only accessible when the proxy is associated with an open session."
);
}

Environment

None

Activity

Show:
Sanne Grinovero
November 28, 2017, 4:31 PM

I verified this and indeed it was failing in Hibernate ORM 5.2.8.Final but it no longer fails when I upgrade to 5.2.12.Final.

I recommend you upgrade. Thanks again for the report!

Sagar Ghai
November 29, 2017, 6:05 AM

Hello,
Would it be possible for you to back port these changes to 5.2.8.Final?

Yoann Rodière
November 29, 2017, 7:54 AM

Would it be possible for you to back port these changes to 5.2.8.Final?

Do you mean release a version 5.2.8-2 for Hibernate ORM with a fix for this specific issue? That's very unlikely to happen. We only have three levels in our versioning scheme, though some vendors such as Red Hat may add a level of their own to backport fixes for their customers.

I don't see the point though: if you are willing to upgrade to a (hypothetical) 5.2.8-2, could you not just upgrade to 5.2.12.Final or later?

Gail Badner
December 5, 2017, 9:01 AM

, , can this be resolved as Out of Date?

Sanne Grinovero
December 5, 2017, 9:03 AM

done. Thanks!

Assignee

Unassigned

Reporter

Rajesh Seth

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.2.8

backportReEvaluate

Components

Affects versions

Priority

Major
Configure