Encapsulates JDBC Connection management logic needed by Hibernate.
The lifecycle is intended to span a logical series of interactions with the
database. Internally, this means the the lifecycle of the Session.
afterStatement
public void afterStatement()
To be called after execution of each JDBC statement. Used to
conditionally release the JDBC connection aggressively if
the configured release mode indicates.
afterTransaction
public void afterTransaction()
To be called after local transaction completion. Used to conditionally
release the JDBC connection aggressively if the configured release mode
indicates.
borrowConnection
public Connection borrowConnection()
close
public Connection close()
To be called after Session completion. Used to release the JDBC
connection.
- The connection mantained here at time of close. Null if
there was no connection cached internally.
flushBeginning
public void flushBeginning()
Callback to let us know that a flush is beginning. We use this fact
to temporarily circumvent aggressive connection releasing until after
the flush cycle is complete
flushEnding()
flushEnding
public void flushEnding()
Callback to let us know that a flush is ending. We use this fact to
stop circumventing aggressive releasing connections.
getBatcher
public Batcher getBatcher()
The batcher managed by this ConnectionManager.
getConnection
public Connection getConnection()
throws HibernateException
Retrieves the connection currently managed by this ConnectionManager.
Note, that we may need to obtain a connection to return here if a
connection has either not yet been obtained (non-UserSuppliedConnectionProvider)
or has previously been aggressively released (if supported in this environment).
HibernateException
- Indicates a connection is currently not
available (we are currently manually disconnected).
hasBorrowedConnection
public boolean hasBorrowedConnection()
isAggressiveRelease
public boolean isAggressiveRelease()
Will connections be released after each statement execution?
Connections will be released after each statement if either:
- True if the connections will be released after each statement; false otherwise.
isAutoCommit
public boolean isAutoCommit()
throws SQLException
Is the connection considered "auto-commit"?
- True if we either do not have a connection, or the connection
really is in auto-commit mode.
isCurrentlyConnected
public boolean isCurrentlyConnected()
Is this ConnectionManager instance "logically" connected. Meaning
do we either have a cached connection available or do we have the
ability to obtain a connection on demand.
- True if logically connected; false otherwise.
isReadyForSerialization
public boolean isReadyForSerialization()
isSuppliedConnection
public boolean isSuppliedConnection()
Was the connection being used here supplied by the user?
- True if the user supplied the JDBC connection; false otherwise
manualDisconnect
public Connection manualDisconnect()
Manually disconnect the underlying JDBC Connection. The assumption here
is that the manager will be reconnected at a later point in time.
- The connection mantained here at time of disconnect. Null if
there was no connection cached internally.
manualReconnect
public void manualReconnect()
Manually reconnect the underlying JDBC Connection. Should be called at
some point after manualDisconnect().
This form is used for ConnectionProvider-supplied connections.
manualReconnect
public void manualReconnect(Connection suppliedConnection)
Manually reconnect the underlying JDBC Connection. Should be called at
some point after manualDisconnect().
This form is used for user-supplied connections.
releaseBorrowedConnection
public void releaseBorrowedConnection()
serialize
public void serialize(ObjectOutputStream oos)
throws IOException