Package org.hibernate.engine.jdbc.spi
Interface StatementPreparer
-
public interface StatementPreparer
Interface to the object that prepares JDBCStatement
s andPreparedStatement
s on behalf of aJdbcCoordinator
.- See Also:
JdbcCoordinator.getStatementPreparer()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Statement
createStatement()
Create a statement.PreparedStatement
prepareQueryStatement(String sql, boolean isCallable, ScrollMode scrollMode)
Get a prepared statement for use in loading / querying.PreparedStatement
prepareStatement(String sql)
Prepare a statement.PreparedStatement
prepareStatement(String sql, boolean isCallable)
Prepare a statement.PreparedStatement
prepareStatement(String sql, int autoGeneratedKeys)
Prepare an INSERT statement, specifying how auto-generated (by the database) keys should be handled.PreparedStatement
prepareStatement(String sql, String[] columnNames)
Prepare an INSERT statement, specifying columns which are auto-generated values to be returned.
-
-
-
Method Detail
-
createStatement
Statement createStatement()
Create a statement.- Returns:
- the statement
-
prepareStatement
PreparedStatement prepareStatement(String sql)
Prepare a statement.- Parameters:
sql
- The SQL the statement to be prepared- Returns:
- the prepared statement
-
prepareStatement
PreparedStatement prepareStatement(String sql, boolean isCallable)
Prepare a statement.- Parameters:
sql
- The SQL the statement to be preparedisCallable
- Whether to prepare as a callable statement.- Returns:
- the prepared statement
-
prepareStatement
PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
Prepare an INSERT statement, specifying how auto-generated (by the database) keys should be handled. Really this is a boolean, but JDBC opted to define it instead using 2 int constants:Generated keys are accessed afterwards via
Statement.getGeneratedKeys()
- Parameters:
sql
- The INSERT SQLautoGeneratedKeys
- The autoGeneratedKeys flag- Returns:
- the prepared statement
- See Also:
Connection.prepareStatement(String, int)
-
prepareStatement
PreparedStatement prepareStatement(String sql, String[] columnNames)
Prepare an INSERT statement, specifying columns which are auto-generated values to be returned. Generated keys are accessed afterwards viaStatement.getGeneratedKeys()
- Parameters:
sql
- - the SQL for the statement to be preparedcolumnNames
- The name of the columns to be returned in the generated keys result set.- Returns:
- the prepared statement
- See Also:
Connection.prepareStatement(String, String[])
-
prepareQueryStatement
PreparedStatement prepareQueryStatement(String sql, boolean isCallable, ScrollMode scrollMode)
Get a prepared statement for use in loading / querying.- Parameters:
sql
- The SQL the statement to be preparedisCallable
- Whether to prepare as a callable statement.scrollMode
- (optional) scroll mode to be applied to the resulting result set; may be null to indicate no scrolling should be applied.- Returns:
- the prepared statement
-
-