Package org.hibernate.id.insert
Interface InsertGeneratedIdentifierDelegate
-
- All Known Implementing Classes:
AbstractReturningDelegate,AbstractSelectingDelegate,BasicSelectingDelegate,GetGeneratedKeysDelegate,InsertReturningDelegate,Oracle12cGetGeneratedKeysDelegate,SybaseJConnGetGeneratedKeysDelegate,UniqueKeySelectingDelegate
public interface InsertGeneratedIdentifierDelegateEach implementation defines a strategy for retrieving a primary key generated by the database from the database after execution of aninsertstatement. The generated primary key is usually anIDENTITYcolumn, but in principle it might be something else, for example, a value generated by a trigger.An implementation controls:
- building the SQL
insertstatement, and - retrieving the generated identifier value using JDBC.
The implementation should be written to handle any instance of
OnExecutionGenerator.- See Also:
OnExecutionGenerator
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description TableInsertBuildercreateTableInsertBuilder(BasicEntityIdentifierMapping identifierMapping, Expectation expectation, SessionFactoryImplementor sessionFactory)Create aTableInsertBuilderwith any specific identity handling already built in.ObjectperformInsert(String insertSQL, SharedSessionContractImplementor session, Binder binder)Execute the giveninsertstatement and return the generated key value.ObjectperformInsert(PreparedStatementDetails insertStatementDetails, JdbcValueBindings valueBindings, Object entity, SharedSessionContractImplementor session)Perform theinsertand extract the database-generated primary key value.default StringprepareIdentifierGeneratingInsert(String insertSQL)Append SQL specific to this delegate's mode of handling generated primary key values to the giveninsertstatement.IdentifierGeneratingInsertprepareIdentifierGeneratingInsert(SqlStringGenerationContext context)Deprecated.this is no longer calledPreparedStatementprepareStatement(String insertSql, SharedSessionContractImplementor session)
-
-
-
Method Detail
-
createTableInsertBuilder
TableInsertBuilder createTableInsertBuilder(BasicEntityIdentifierMapping identifierMapping, Expectation expectation, SessionFactoryImplementor sessionFactory)
Create aTableInsertBuilderwith any specific identity handling already built in.
-
prepareStatement
PreparedStatement prepareStatement(String insertSql, SharedSessionContractImplementor session)
-
performInsert
Object performInsert(PreparedStatementDetails insertStatementDetails, JdbcValueBindings valueBindings, Object entity, SharedSessionContractImplementor session)
Perform theinsertand extract the database-generated primary key value.
-
prepareIdentifierGeneratingInsert
@Deprecated(since="6.2") IdentifierGeneratingInsert prepareIdentifierGeneratingInsert(SqlStringGenerationContext context)
Deprecated.this is no longer calledBuild an insert statement specific to the delegate's mode of handling generated key values.- Parameters:
context- A context to help generate SQL strings- Returns:
- An
IdentifierGeneratingInsert
-
prepareIdentifierGeneratingInsert
default String prepareIdentifierGeneratingInsert(String insertSQL)
Append SQL specific to this delegate's mode of handling generated primary key values to the giveninsertstatement.- Returns:
- The processed
insertstatement string
-
performInsert
Object performInsert(String insertSQL, SharedSessionContractImplementor session, Binder binder)
Execute the giveninsertstatement and return the generated key value.- Parameters:
insertSQL- Theinsertstatement stringsession- The session in which we are operatingbinder- The parameter binder- Returns:
- The generated identifier value
-
-