Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-3737

HHH-3220 Patch to prevent "org.hibernate.AssertionFailure: possible non-threadsafe access to the session" error caused by stateless sessions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: EAP 5.0.0, EAP 5.0.1
    • Fix Version/s: EAP_EWP 5.1.0
    • Component/s: Hibernate
    • Labels:
      None
    • Environment:

      EAP 5.0.0 with the included Hibernate

    • Affects:
      Release Notes
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      One workaround is to increase the maximum fetch depth until the error no longer occurs, by setting the hibernate.max_fetch_depth property to a large value.
      or change the fetch mode of the association to "select" instead of "join"

      Show
      One workaround is to increase the maximum fetch depth until the error no longer occurs, by setting the hibernate.max_fetch_depth property to a large value. or change the fetch mode of the association to "select" instead of "join"

      Description

      Is related to: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3220

      ==========
      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.
      ==========

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                stliu Strong Liu
                Reporter:
                sjmenden Samuel Mendenhall
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: