[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3220) Patch to prevent "org.hibernate.AssertionFailure: possible non-threadsafe access to the session" error caused by stateless sessions

Xavier Poinsard (JIRA) noreply at atlassian.com
Tue Jan 27 05:48:38 EST 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32199#action_32199 ] 

Xavier Poinsard commented on HHH-3220:
--------------------------------------

For reference here are two threads that are referencing the same problem : 
http://forum.hibernate.org/viewtopic.php?t=957223
http://forum.hibernate.org/viewtopic.php?t=953857

> 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
>            Priority: Minor
>         Attachments: 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.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list