Package org.apache.openjpa.jdbc.kernel
Class PreparedStatementManagerImpl
- java.lang.Object
 - 
- org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl
 
 
- 
- All Implemented Interfaces:
 PreparedStatementManager
- Direct Known Subclasses:
 BatchingPreparedStatementManagerImpl
public class PreparedStatementManagerImpl extends Object implements PreparedStatementManager
Basic prepared statement manager implementation.- Author:
 - Abe White
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected Connection_connprotected DBDictionary_dictprotected Collection<Exception>_exceptionsprotected Log_logprotected JDBCStore_store 
- 
Constructor Summary
Constructors Constructor Description PreparedStatementManagerImpl(JDBCStore store, Connection conn)Constructor. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intexecuteUpdate(PreparedStatement stmnt, String sql, RowImpl row)This method is to provide override for non-JDBC or JDBC-like implementation of executing update.voidflush()This method must be called after the last row has been flushed, to flush any remaining statements.voidflush(RowImpl row)Flush the given row.protected voidflushAndUpdate(RowImpl row)Flush the given row immediately.protected voidflushInternal(RowImpl row)Flush the given row.protected String[]getAutoAssignColNames(Column[] autoAssign, RowImpl row)protected Column[]getAutoAssignColumns(RowImpl row)Collection<Exception>getExceptions()Return the exceptions encountered during all flushes.protected List<Object>getGeneratedKeys(PreparedStatement stmnt, String[] autoAssignColNames)This method will only be called when the database supports getGeneratedKeys.protected List<Object>getGeneratedKeys(PreparedStatement stmnt, DBIdentifier[] autoAssignColNames)protected voidlogSQLWarnings(PreparedStatement stmt)Provided the JDBC log category is logging warnings, this method will log any SQL warnings that result from the execution of a SQL statement.protected voidlogSQLWarnings(Statement stmt)protected List<Object>populateAutoAssignCols(PreparedStatement stmnt, Column[] autoAssign, String[] autoAssignColNames, RowImpl row)protected List<Object>populateAutoAssignCols(PreparedStatement stmnt, Column[] autoAssign, DBIdentifier[] autoAssignColNames, RowImpl row)This method will only be called when there is auto assign columns.protected PreparedStatementprepareStatement(String sql)This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.protected PreparedStatementprepareStatement(String sql, String[] autoAssignColNames)This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.protected voidsetObjectId(List vals, Column[] autoAssign, String[] autoAssignColNames, RowImpl row)protected voidsetObjectId(List vals, Column[] autoAssign, DBIdentifier[] autoAssignColNames, RowImpl row) 
 - 
 
- 
- 
Field Detail
- 
_store
protected final JDBCStore _store
 
- 
_conn
protected final Connection _conn
 
- 
_dict
protected final DBDictionary _dict
 
- 
_log
protected transient Log _log
 
- 
_exceptions
protected final Collection<Exception> _exceptions
 
 - 
 
- 
Constructor Detail
- 
PreparedStatementManagerImpl
public PreparedStatementManagerImpl(JDBCStore store, Connection conn)
Constructor. Supply connection. 
 - 
 
- 
Method Detail
- 
getExceptions
public Collection<Exception> getExceptions()
Description copied from interface:PreparedStatementManagerReturn the exceptions encountered during all flushes.- Specified by:
 getExceptionsin interfacePreparedStatementManager
 
- 
flush
public void flush(RowImpl row)
Description copied from interface:PreparedStatementManagerFlush the given row.- Specified by:
 flushin interfacePreparedStatementManager
 
- 
flushInternal
protected void flushInternal(RowImpl row) throws SQLException
Flush the given row.- Throws:
 SQLException
 
- 
flushAndUpdate
protected void flushAndUpdate(RowImpl row) throws SQLException
Flush the given row immediately.- Throws:
 SQLException
 
- 
populateAutoAssignCols
protected List<Object> populateAutoAssignCols(PreparedStatement stmnt, Column[] autoAssign, DBIdentifier[] autoAssignColNames, RowImpl row) throws SQLException
This method will only be called when there is auto assign columns. If database supports getGeneratedKeys, the keys will be obtained from the result set associated with the stmnt. If not, a separate sql to select the key will be issued from DBDictionary.- Throws:
 SQLException
 
- 
populateAutoAssignCols
protected List<Object> populateAutoAssignCols(PreparedStatement stmnt, Column[] autoAssign, String[] autoAssignColNames, RowImpl row) throws SQLException
- Throws:
 SQLException
 
- 
setObjectId
protected void setObjectId(List vals, Column[] autoAssign, String[] autoAssignColNames, RowImpl row) throws SQLException
- Throws:
 SQLException
 
- 
setObjectId
protected void setObjectId(List vals, Column[] autoAssign, DBIdentifier[] autoAssignColNames, RowImpl row) throws SQLException
- Throws:
 SQLException
 
- 
getGeneratedKeys
protected List<Object> getGeneratedKeys(PreparedStatement stmnt, String[] autoAssignColNames) throws SQLException
This method will only be called when the database supports getGeneratedKeys.- Throws:
 SQLException
 
- 
getGeneratedKeys
protected List<Object> getGeneratedKeys(PreparedStatement stmnt, DBIdentifier[] autoAssignColNames) throws SQLException
- Throws:
 SQLException
 
- 
flush
public void flush()
Description copied from interface:PreparedStatementManagerThis method must be called after the last row has been flushed, to flush any remaining statements.- Specified by:
 flushin interfacePreparedStatementManager
 
- 
executeUpdate
protected int executeUpdate(PreparedStatement stmnt, String sql, RowImpl row) throws SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of executing update.- Throws:
 SQLException
 
- 
prepareStatement
protected PreparedStatement prepareStatement(String sql) throws SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.- Throws:
 SQLException
 
- 
prepareStatement
protected PreparedStatement prepareStatement(String sql, String[] autoAssignColNames) throws SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.- Throws:
 SQLException
 
- 
logSQLWarnings
protected void logSQLWarnings(PreparedStatement stmt)
Provided the JDBC log category is logging warnings, this method will log any SQL warnings that result from the execution of a SQL statement. 
- 
logSQLWarnings
protected void logSQLWarnings(Statement stmt)
 
 - 
 
 -