generate method may execute arbitrary Java code. It may even, in principle,
access the database via JDBC. But however it's produced, the generated value is sent to the
database via a parameter of a JDBC prepared statement, just like any other field or property
value.
Any BeforeExecutionGenerator with generation event types
EventTypeSets#INSERT_ONLY may be used to produce identifiers. The built-in identifier generators all implement the older extension point
org., which is a subtype of this interface, but that
is no longer a requirement for custom id generators.
A custom id generator may be integrated with the program using either:
org.hibernate.annotations.IdGeneratorType or
org.hibernate.annotations.GenericGenerator .
On the other hand, generators for regular fields and properties may be integrated using
org., as for any Generator.
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: The generated valueThe session from which the request originates. session, Object The instance of the object owning the attribute for which we are generating a value. owner, Object The current value assigned to the property, or currentValue, EventType nullThe type of event that has triggered generation of a new value eventType)Generate a value. |
| public default boolean | generatedOnExecution()
Implements org. |
| generate | back to summary |
|---|---|
| public Object generate(SharedSessionContractImplementor session, Object owner, Object currentValue, EventType eventType) Generate a value.
| |
| 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.
| |