public abstract class AbstractBatcher extends Object implements Batcher
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
log |
| Constructor and Description |
|---|
AbstractBatcher(ConnectionManager connectionManager,
Interceptor interceptor) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddToBatchpublic AbstractBatcher(ConnectionManager connectionManager, Interceptor interceptor)
public void setTransactionTimeout(int seconds)
BatchersetTransactionTimeout in interface Batcherpublic void unsetTransactionTimeout()
BatcherunsetTransactionTimeout in interface Batcherprotected PreparedStatement getStatement()
public CallableStatement prepareCallableStatement(String sql) throws SQLException, HibernateException
BatcherBatcher.closeStatement(java.sql.PreparedStatement) after use.prepareCallableStatement in interface BatcherSQLExceptionHibernateExceptionpublic PreparedStatement prepareStatement(String sql) throws SQLException, HibernateException
BatcherBatcher.closeStatement(java.sql.PreparedStatement) after use.prepareStatement in interface BatcherSQLExceptionHibernateExceptionpublic PreparedStatement prepareStatement(String sql, boolean getGeneratedKeys) throws SQLException, HibernateException
BatcherConnection.prepareStatement(String, int)).
Must be explicitly released by Batcher.closeStatement(java.sql.PreparedStatement) after use.prepareStatement in interface BatcherSQLExceptionHibernateExceptionpublic PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException, HibernateException
BatcherConnection.prepareStatement(String, String[])).
Must be explicitly released by Batcher.closeStatement(java.sql.PreparedStatement) after use.prepareStatement in interface BatcherSQLExceptionHibernateExceptionpublic PreparedStatement prepareSelectStatement(String sql) throws SQLException, HibernateException
BatcherprepareSelectStatement in interface BatcherSQLExceptionHibernateExceptionpublic PreparedStatement prepareQueryStatement(String sql, boolean scrollable, ScrollMode scrollMode) throws SQLException, HibernateException
BatcherprepareQueryStatement in interface BatcherSQLExceptionHibernateExceptionpublic CallableStatement prepareCallableQueryStatement(String sql, boolean scrollable, ScrollMode scrollMode) throws SQLException, HibernateException
BatcherprepareCallableQueryStatement in interface BatcherSQLExceptionHibernateExceptionpublic void abortBatch(SQLException sqle)
BatcherabortBatch in interface Batchersqle - the (not null) exception that is the reason for abortingpublic ResultSet getResultSet(PreparedStatement ps) throws SQLException
BatchergetResultSet in interface BatcherSQLExceptionpublic ResultSet getResultSet(CallableStatement ps, Dialect dialect) throws SQLException
BatchergetResultSet in interface BatcherSQLExceptionpublic void closeQueryStatement(PreparedStatement ps, ResultSet rs) throws SQLException
BatchercloseQueryStatement in interface BatcherSQLExceptionpublic PreparedStatement prepareBatchStatement(String sql) throws SQLException, HibernateException
BatcherprepareBatchStatement in interface BatcherSQLExceptionHibernateExceptionBatcher.addToBatch(org.hibernate.jdbc.Expectation)public CallableStatement prepareBatchCallableStatement(String sql) throws SQLException, HibernateException
BatcherprepareBatchCallableStatement in interface BatcherSQLExceptionHibernateExceptionBatcher.addToBatch(org.hibernate.jdbc.Expectation)public void executeBatch()
throws HibernateException
BatcherexecuteBatch in interface BatcherHibernateExceptionpublic void closeStatement(PreparedStatement ps) throws SQLException
BatchercloseStatement in interface BatcherSQLExceptionpublic void closeStatements()
closeStatements in interface Batcherprotected abstract void doExecuteBatch(PreparedStatement ps) throws SQLException, HibernateException
SQLExceptionHibernateExceptionprotected SessionFactoryImplementor getFactory()
public Connection openConnection() throws HibernateException
BatcheropenConnection in interface BatcherHibernateExceptionpublic void closeConnection(Connection conn) throws HibernateException
BatchercloseConnection in interface BatcherHibernateExceptionpublic void cancelLastQuery()
throws HibernateException
BatchercancelLastQuery in interface BatcherHibernateExceptionpublic boolean hasOpenResources()
hasOpenResources in interface Batcherpublic String openResourceStatsAsString()
openResourceStatsAsString in interface BatcherCopyright © 2002-2017 Red Hat Middleware, LLC. All Rights Reserved