insert or update statement which wrote the row.
A value generated by the database might be generated implicitly, by a trigger, or using
a default column value specified in DDL, for example, or it might be generated
by a SQL expression occurring explicitly in the SQL insert or update
statement.
The generated value is usually retrieved from the database using a SQL select,
but in certain cases this additional round
trip may be avoided.
Implementations should override referenceColumnsInSql(Dialect),
writePropertyValue(), and getReferencedColumnValues(Dialect) as needed
in order to achieve the desired behavior.
In implementation of this interface does not specify how the generated value is retrieved
from the database after it is generated, this being the responsibility of the coordinating
code in org. or in an
implementation of org..
| Modifier and Type | Method and Description |
|---|---|
| public default boolean | generatedOnExecution()
Implements org. |
| public default InsertGeneratedIdentifierDelegate | getGeneratedIdentifierDelegate(PostInsertIdentityPersister persister)
The |
| public String[] | Returns: The column value to be used in the generated SQL statement.The SQL dialect, allowing generation of an expression
in dialect-specific SQL. dialect)A SQL expression indicating how to calculate the generated values when the mapped columns are included in the SQL statement. |
| public default String[] | getUniqueKeyPropertyNames(EntityPersister persister)
The name of a property of the entity which may be used to locate the just- |
| public boolean | Returns: true if the column is included in the column list of the SQL statement.Determines if the columns whose values are generated are included in the column list
of the SQL |
| public boolean | writePropertyValue()
Determines if the property values are written to JDBC as the argument of a JDBC |
| generatedOnExecution | back to summary |
|---|---|
| public default boolean generatedOnExecution() Implements org. Doc from org. Determines if the property value is generated when a row is written to the database, or in Java code that executes before the row is written.
| |
| getGeneratedIdentifierDelegate | back to summary |
|---|---|
| public default InsertGeneratedIdentifierDelegate getGeneratedIdentifierDelegate(PostInsertIdentityPersister persister) 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) 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:
| |
| getUniqueKeyPropertyNames | back to summary |
|---|---|
| public default String[] getUniqueKeyPropertyNames(EntityPersister persister) The name of a property of the entity which may be used to locate the just-
The default implementation uses the
| |
| referenceColumnsInSql | back to summary |
|---|---|
| public boolean referenceColumnsInSql(Dialect dialect) Determines if the columns whose values are generated are included in the column list
of the SQL
| |
| writePropertyValue | back to summary |
|---|---|
| public boolean writePropertyValue() Determines if the property values are written to JDBC as the argument of a JDBC | |