]
Strong Liu commented on HHH-3220:
---------------------------------
please open a new jira, and link it with this one, thanks
Patch to prevent "org.hibernate.AssertionFailure: possible
non-threadsafe access to the session" error caused by stateless sessions
-----------------------------------------------------------------------------------------------------------------------------------
Key: HHH-3220
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3220
Project: Hibernate Core
Issue Type: Patch
Components: core
Affects Versions: 3.2.6
Environment: Hibernate 3.2.6, Apache Derby on Mac OSX & PC
Reporter: Dan Bisalputra
Assignee: Strong Liu
Priority: Minor
Fix For: 3.5.3, 3.6.0.Beta1
Attachments: HibernateStatelessSessionCriteriaAssertionFailureTest.java,
HibernateStatelessSessionCriteriaAssertionFailureTest.java, StatelessSession-patch
When performing a query in a stateless session, the query loads objects in a two-phase
process in which a temporary persistence context is populated with empty objects in the
first phase, then the objects' member data are read from the database in the second
phase. If one of the objects contains an association or a collection, it performs a
recursive call to the session's get() method. The get() method clears the temporary
persistence context, so if the parent object contains any other associations to be read in
the second phase, Hibernate throws an assertion because they are not found in the
persistence context.
This patch solves the problem by only clearing the persistence context when the recursion
ends. It passes all the unit tests for our application, but I have not tested it with any
of the Hibernate unit tests.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: