Top Description Methods
org.hibernate.id.insert

public Interface InsertGeneratedIdentifierDelegate

Known Direct Implementers
org.hibernate.id.insert.AbstractReturningDelegate, org.hibernate.id.insert.AbstractSelectingDelegate
Imports
java.sql.PreparedStatement, org.hibernate.boot.model.relational.SqlStringGenerationContext, org.hibernate.engine.jdbc.mutation.JdbcValueBindings, org.hibernate.engine.jdbc.mutation.group.PreparedStatementDetails, org.hibernate.engine.spi.SessionFactoryImplementor, .SharedSessionContractImplementor, org.hibernate.jdbc.Expectation, org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping, org.hibernate.sql.model.ast.builder.TableInsertBuilder

Each implementation defines a strategy for retrieving a primary key generated by the database from the database after execution of an insert statement. The generated primary key is usually an IDENTITY column, but in principle it might be something else, for example, a value generated by a trigger.

An implementation controls:

The implementation should be written to handle any instance of org.hibernate.generator.OnExecutionGenerator.

Author
Steve Ebersole
See Also
org.hibernate.generator.OnExecutionGenerator

Method Summary

Modifier and TypeMethod and Description
public TableInsertBuilder
createTableInsertBuilder(BasicEntityIdentifierMapping identifierMapping, Expectation expectation, SessionFactoryImplementor sessionFactory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Create a TableInsertBuilder with any specific identity handling already built in.
public Object
performInsert(PreparedStatementDetails insertStatementDetails, JdbcValueBindings valueBindings, Object entity, SharedSessionContractImplementor session)

Perform the insert and extract the database-generated primary key value.

public Object

Returns:

The generated identifier value
performInsert
(String
The insert statement string
insertSQL
,
SharedSessionContractImplementor
The session in which we are operating
session
,
Binder
The parameter binder
binder
)

Execute the given insert statement and return the generated key value.

public IdentifierGeneratingInsert
prepareIdentifierGeneratingInsert(SqlStringGenerationContext
A context to help generate SQL strings
context
)

Deprecated since 6.2. this is no longer called
Build an insert statement specific to the delegate's mode of handling generated key values.
public default String

Returns:

The processed insert statement string
prepareIdentifierGeneratingInsert
(String insertSQL)

Append SQL specific to this delegate's mode of handling generated primary key values to the given insert statement.

public PreparedStatement

Method Detail

createTableInsertBuilderback to summary
public TableInsertBuilder createTableInsertBuilder(BasicEntityIdentifierMapping identifierMapping, Expectation expectation, SessionFactoryImplementor sessionFactory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Create a TableInsertBuilder with any specific identity handling already built in.

performInsertback to summary
public Object performInsert(PreparedStatementDetails insertStatementDetails, JdbcValueBindings valueBindings, Object entity, SharedSessionContractImplementor session)

Perform the insert and extract the database-generated primary key value.

See Also
createTableInsertBuilder
performInsertback to summary
public Object performInsert(String insertSQL, SharedSessionContractImplementor session, Binder binder)

Execute the given insert statement and return the generated key value.

Parameters
insertSQL:String

The insert statement string

session:SharedSessionContractImplementor

The session in which we are operating

binder:Binder

The parameter binder

Returns:Object

The generated identifier value

prepareIdentifierGeneratingInsertback to summary
public IdentifierGeneratingInsert prepareIdentifierGeneratingInsert(SqlStringGenerationContext context)

Deprecated

since 6.2.

this is no longer called

Build an insert statement specific to the delegate's mode of handling generated key values.

Parameters
context:SqlStringGenerationContext

A context to help generate SQL strings

Returns:IdentifierGeneratingInsert

An IdentifierGeneratingInsert

Annotations
@Deprecated
since:6.2
prepareIdentifierGeneratingInsertback to summary
public default String prepareIdentifierGeneratingInsert(String insertSQL)

Append SQL specific to this delegate's mode of handling generated primary key values to the given insert statement.

Returns:String

The processed insert statement string

prepareStatementback to summary
public PreparedStatement prepareStatement(String insertSql, SharedSessionContractImplementor session)