|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.jdbc.AbstractBatcher
Manages prepared statements and batching.
Field Summary | |
protected static org.apache.commons.logging.Log |
log
|
protected static org.apache.commons.logging.Log |
SQL_LOG
|
Constructor Summary | |
AbstractBatcher(ConnectionManager connectionManager,
Interceptor interceptor)
|
Method Summary | |
void |
abortBatch(SQLException sqle)
Must be called when an exception occurs |
void |
cancelLastQuery()
Cancel the current query statement |
void |
closeConnection(Connection conn)
Dispose of the JDBC connection |
void |
closeQueryStatement(PreparedStatement ps,
ResultSet rs)
Close a prepared statement opened with prepareQueryStatement() |
void |
closeStatement(PreparedStatement ps)
Close a prepared or callable statement opened using prepareStatement() or prepareCallableStatement() |
void |
closeStatements()
Actually releases the batcher, allowing it to cleanup internally held resources. |
protected abstract void |
doExecuteBatch(PreparedStatement ps)
|
void |
executeBatch()
Execute the batch |
protected SessionFactoryImplementor |
getFactory()
|
ResultSet |
getResultSet(CallableStatement ps,
Dialect dialect)
Execute the statement and return the result set from a callable statement |
ResultSet |
getResultSet(PreparedStatement ps)
Execute the statement and return the result set |
protected PreparedStatement |
getStatement()
|
boolean |
hasOpenResources()
|
Connection |
openConnection()
Obtain a JDBC connection |
String |
openResourceStatsAsString()
|
CallableStatement |
prepareBatchCallableStatement(String sql)
Get a batchable callable statement to use for inserting / deleting / updating (might be called many times before a single call to executeBatch()). |
PreparedStatement |
prepareBatchStatement(String sql)
Get a batchable prepared statement to use for inserting / deleting / updating (might be called many times before a single call to executeBatch()). |
CallableStatement |
prepareCallableQueryStatement(String sql,
boolean scrollable,
ScrollMode scrollMode)
Get a prepared statement for use in loading / querying. |
CallableStatement |
prepareCallableStatement(String sql)
Get a non-batchable callable statement to use for inserting / deleting / updating. |
PreparedStatement |
prepareQueryStatement(String sql,
boolean scrollable,
ScrollMode scrollMode)
Get a prepared statement for use in loading / querying. |
PreparedStatement |
prepareSelectStatement(String sql)
Get a non-batchable prepared statement to use for selecting. |
PreparedStatement |
prepareStatement(String sql)
Get a non-batchable prepared statement to use for inserting / deleting / updating. |
PreparedStatement |
prepareStatement(String sql,
boolean getGeneratedKeys)
Get a non-batchable prepared statement to use for inserting / deleting / updating, using JDBC3 getGeneratedKeys ( Connection.prepareStatement(String, int) ). |
PreparedStatement |
prepareStatement(String sql,
String[] columnNames)
Get a non-batchable prepared statement to use for inserting / deleting / updating. |
void |
setTransactionTimeout(int seconds)
Set the transaction timeout to seconds later than the current system time. |
void |
unsetTransactionTimeout()
Unset the transaction timeout, called after the end of a transaction. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.hibernate.jdbc.Batcher |
addToBatch |
Field Detail |
protected static final org.apache.commons.logging.Log log
protected static final org.apache.commons.logging.Log SQL_LOG
Constructor Detail |
public AbstractBatcher(ConnectionManager connectionManager, Interceptor interceptor)
Method Detail |
public void setTransactionTimeout(int seconds)
Batcher
setTransactionTimeout
in interface Batcher
public void unsetTransactionTimeout()
Batcher
unsetTransactionTimeout
in interface Batcher
protected PreparedStatement getStatement()
public CallableStatement prepareCallableStatement(String sql) throws SQLException, HibernateException
Batcher
Batcher.closeStatement(java.sql.PreparedStatement)
after use.
prepareCallableStatement
in interface Batcher
SQLException
HibernateException
public PreparedStatement prepareStatement(String sql) throws SQLException, HibernateException
Batcher
Batcher.closeStatement(java.sql.PreparedStatement)
after use.
prepareStatement
in interface Batcher
SQLException
HibernateException
public PreparedStatement prepareStatement(String sql, boolean getGeneratedKeys) throws SQLException, HibernateException
Batcher
Connection.prepareStatement(String, int)
).
Must be explicitly released by Batcher.closeStatement(java.sql.PreparedStatement)
after use.
prepareStatement
in interface Batcher
SQLException
HibernateException
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException, HibernateException
Batcher
Connection.prepareStatement(String, String[])
).
Must be explicitly released by Batcher.closeStatement(java.sql.PreparedStatement)
after use.
prepareStatement
in interface Batcher
SQLException
HibernateException
public PreparedStatement prepareSelectStatement(String sql) throws SQLException, HibernateException
Batcher
prepareSelectStatement
in interface Batcher
SQLException
HibernateException
public PreparedStatement prepareQueryStatement(String sql, boolean scrollable, ScrollMode scrollMode) throws SQLException, HibernateException
Batcher
prepareQueryStatement
in interface Batcher
SQLException
HibernateException
public CallableStatement prepareCallableQueryStatement(String sql, boolean scrollable, ScrollMode scrollMode) throws SQLException, HibernateException
Batcher
prepareCallableQueryStatement
in interface Batcher
SQLException
HibernateException
public void abortBatch(SQLException sqle)
Batcher
abortBatch
in interface Batcher
sqle
- the (not null) exception that is the reason for abortingpublic ResultSet getResultSet(PreparedStatement ps) throws SQLException
Batcher
getResultSet
in interface Batcher
SQLException
public ResultSet getResultSet(CallableStatement ps, Dialect dialect) throws SQLException
Batcher
getResultSet
in interface Batcher
SQLException
public void closeQueryStatement(PreparedStatement ps, ResultSet rs) throws SQLException
Batcher
closeQueryStatement
in interface Batcher
SQLException
public PreparedStatement prepareBatchStatement(String sql) throws SQLException, HibernateException
Batcher
prepareBatchStatement
in interface Batcher
public CallableStatement prepareBatchCallableStatement(String sql) throws SQLException, HibernateException
Batcher
prepareBatchCallableStatement
in interface Batcher
public void executeBatch() throws HibernateException
Batcher
executeBatch
in interface Batcher
HibernateException
public void closeStatement(PreparedStatement ps) throws SQLException
Batcher
closeStatement
in interface Batcher
SQLException
public void closeStatements()
closeStatements
in interface Batcher
protected abstract void doExecuteBatch(PreparedStatement ps) throws SQLException, HibernateException
SQLException
HibernateException
protected SessionFactoryImplementor getFactory()
public Connection openConnection() throws HibernateException
Batcher
openConnection
in interface Batcher
HibernateException
public void closeConnection(Connection conn) throws HibernateException
Batcher
closeConnection
in interface Batcher
HibernateException
public void cancelLastQuery() throws HibernateException
Batcher
cancelLastQuery
in interface Batcher
HibernateException
public boolean hasOpenResources()
hasOpenResources
in interface Batcher
public String openResourceStatsAsString()
openResourceStatsAsString
in interface Batcher
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |