Package org.hibernate.id.insert
Class AbstractSelectingDelegate
- java.lang.Object
-
- org.hibernate.id.insert.AbstractSelectingDelegate
-
- All Implemented Interfaces:
InsertGeneratedIdentifierDelegate
- Direct Known Subclasses:
BasicSelectingDelegate
,UniqueKeySelectingDelegate
public abstract class AbstractSelectingDelegate extends Object implements InsertGeneratedIdentifierDelegate
AbstractInsertGeneratedIdentifierDelegate
implementation where the underlying strategy requires a subsequentselect
after theinsert
to determine the generated identifier.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSelectingDelegate(PostInsertIdentityPersister persister)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
bindParameters(Object entity, PreparedStatement ps, SharedSessionContractImplementor session)
protected Object
extractGeneratedValue(ResultSet resultSet, SharedSessionContractImplementor session)
Extract the generated key value from the given result set after execution ofgetSelectSQL()
.protected abstract String
getSelectSQL()
Get the SQL statement to be used to retrieve generated key values.Object
performInsert(String insertSQL, SharedSessionContractImplementor session, Binder binder)
Execute the giveninsert
statement and return the generated key value.Object
performInsert(PreparedStatementDetails insertStatementDetails, JdbcValueBindings jdbcValueBindings, Object entity, SharedSessionContractImplementor session)
Perform theinsert
and extract the database-generated primary key value.PreparedStatement
prepareStatement(String insertSql, SharedSessionContractImplementor session)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.id.insert.InsertGeneratedIdentifierDelegate
createTableInsertBuilder, prepareIdentifierGeneratingInsert, prepareIdentifierGeneratingInsert
-
-
-
-
Constructor Detail
-
AbstractSelectingDelegate
protected AbstractSelectingDelegate(PostInsertIdentityPersister persister)
-
-
Method Detail
-
getSelectSQL
protected abstract String getSelectSQL()
Get the SQL statement to be used to retrieve generated key values.- Returns:
- The SQL command string
-
bindParameters
protected void bindParameters(Object entity, PreparedStatement ps, SharedSessionContractImplementor session) throws SQLException
- Throws:
SQLException
-
extractGeneratedValue
protected Object extractGeneratedValue(ResultSet resultSet, SharedSessionContractImplementor session) throws SQLException
Extract the generated key value from the given result set after execution ofgetSelectSQL()
.- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String insertSql, SharedSessionContractImplementor session)
- Specified by:
prepareStatement
in interfaceInsertGeneratedIdentifierDelegate
-
performInsert
public Object performInsert(PreparedStatementDetails insertStatementDetails, JdbcValueBindings jdbcValueBindings, Object entity, SharedSessionContractImplementor session)
Description copied from interface:InsertGeneratedIdentifierDelegate
Perform theinsert
and extract the database-generated primary key value.
-
performInsert
public final Object performInsert(String insertSQL, SharedSessionContractImplementor session, Binder binder)
Description copied from interface:InsertGeneratedIdentifierDelegate
Execute the giveninsert
statement and return the generated key value.- Specified by:
performInsert
in interfaceInsertGeneratedIdentifierDelegate
- Parameters:
insertSQL
- Theinsert
statement stringsession
- The session in which we are operatingbinder
- The parameter binder- Returns:
- The generated identifier value
-
-