Hibernate Connection Release Modes:
The different release modes that are supported by Hibernate are as follows:
1.
on_close: The
Hibernate session obtains a connection when it first needs to perform some JDBC access
and maintains that connection until the session is closed.
2. after_transaction: uses ConnectionReleaseMode.AFTER_TRANSACTION.
This setting should not be used in JTA environments. Also note that with
ConnectionReleaseMode.AFTER_TRANSACTION, if a session is considered to be in auto-commit
mode, connections will be released as if the release mode were AFTER_STATEMENT.
3. after_statement: uses ConnectionReleaseMode.AFTER_STATEMENT. Additionally,
the configured
ConnectionProvider
is consulted to see if it supports this
setting (supportsAggressiveRelease()
). If not, the release mode is reset
to ConnectionReleaseMode.AFTER_TRANSACTION. This setting is only safe in environments where
we can either re-acquire the same underlying JDBC connection each time you make a call into
ConnectionProvider.getConnection()
or in auto-commit environments where
it does not matter if we re-establish the same connection
No comments:
Post a Comment