OnExecutionGenerator that handles IDENTITY/"autoincrement"
columns on those databases which support them.
Delegates to the org.
provided by the dialect.
The actual work involved in retrieving the primary key value is the job of a
org., either:
Implementation Note
This also implements the identity generation type in hbm.xml mappings.
jakarta.persistence.GenerationType#IDENTITY , org.hibernate.dialect.identity.IdentityColumnSupport , org.hibernate.id.insert.InsertGeneratedIdentifierDelegate
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public InsertGeneratedIdentifierDelegate | getGeneratedIdentifierDelegate(PostInsertIdentityPersister persister)
Overrides default org. InsertGeneratedIdentifierDelegate used to retrieve the generated value if this
object is an identifier generator.
|
| public String[] | getReferencedColumnValues(Dialect
The SQL dialect, allowing generation of an expression
in dialect-specific SQL. dialect)Implements org. |
| public boolean | referenceColumnsInSql(Dialect dialect)
Implements org. insert or update statement.
|
| IdentityGenerator | back to summary |
|---|---|
| public IdentityGenerator() | |
| getGeneratedIdentifierDelegate | back to summary |
|---|---|
| public InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(PostInsertIdentityPersister persister) Overrides default org. Doc from org. The
This is ignored by Note that this method arguably breaks the separation of concerns between the generator and coordinating code, by specifying how the generated value should be retrieved. The problem solved here is: we want to obtain an insert-generated primary key. But, sadly, without already knowing the primary key, there's no completely-generic way to locate the just-inserted row to obtain it. We need one of the following things:
Alternatively, if the generated id is an identity/"autoincrement" column, we can take
advantage of special platform-specific functionality to retrieve it. Taking advantage
of the specialness of identity columns is the job of one particular implementation:
| |
| getReferencedColumnValues | back to summary |
|---|---|
| public String[] getReferencedColumnValues(Dialect dialect) Implements org. Doc from org. A SQL expression indicating how to calculate the generated values when the mapped columns are included in the SQL statement. The SQL expressions might be:
| |
| referenceColumnsInSql | back to summary |
|---|---|
| public boolean referenceColumnsInSql(Dialect dialect) Implements org. Doc from org. Determines if the columns whose values are generated are included in the column list
of the SQL
| |