Uploaded image for project: 'Hibernate ORM'
  1. HHH-12934

Exception handling documentation does not apply only to "Session-per-application anti-pattern"


    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.2.17, 5.1.15, 5.3.6
    • Fix Version/s: 5.4.0.CR1, 5.3.7
    • Component/s: documentation
    • Labels:
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • backPortable:
    • Last commented by a user?:
    • Sprint:


      In the 5.1, 5.2, and 5.3 Hibernate user manuals, there is a section titled "Session-per-application anti-pattern", which states:

      "An exception thrown by Hibernate means you have to rollback your database transaction and close the Session immediately. If your Session is bound to the application, you have to stop the application. Rolling back the database transaction does not put your business objects back into the state they were at the start of the transaction. This means that the database state and the business objects will be out of sync. Usually, this is not a problem because exceptions are not recoverable and you will have to start over after rollback anyway."

      The above generally applies outside of the "session-per-application" context. In Hibernate 4.2 docs [1], it is less of a subtopic.

      Also, Hibernate 4 doc includes an emphatic warning [2] that is not in the Hibernate 5 doc:

      "Certain methods of Session will not leave the session in a consistent state. No exception thrown by Hibernate can be treated as recoverable."

      There should be a special section dedicated to the exception handling issue, and the above warning should be included.

      [1] http://docs.jboss.org/hibernate/orm/4.2/manual/en-US/html_single/#transactions-basics-issues
      [2] http://docs.jboss.org/hibernate/orm/4.2/manual/en-US/html_single/#transactions-demarcation-exceptions


          Issue links



              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: