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

Description

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

Environment

None

Status

Assignee

Vlad Mihalcea

Reporter

Gail Badner

Fix versions

Labels

None

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure