select after it is generated.
@Generated relieves the program of the need to explicitly call
refresh() to synchronize
state held in memory with state generated by the database when a SQL
insert or update is executed.
This is most useful when:
@Generated is used in conjunction with ColumnDefault,
insert or update
statement specified by an entity assigns a value to the annotated
property of the entity, or transforms the
value currently assigned to the annotated property.
On the other hand:
jakarta.persistence.GeneratedValue , and
generated always as clause, prefer the
GeneratedColumn annotation, so that Hibernate automatically
generates the correct DDL.
jakarta.persistence.GeneratedValue , ColumnDefault, GeneratedColumn
| Modifier and Type | Method and Description |
|---|---|
| public EventType[] | |
| public String | |
| public GenerationTime | |
| public boolean | Returns: true if the current value should be included in SQL
insert and update statements.Determines if the value currently assigned to the annotated property
is included in SQL |
| event | back to summary |
|---|---|
| public EventType[] event() Specifies the events that cause the value to be generated by the database.
| |
| sql | back to summary |
|---|---|
| public String sql() A SQL expression used to generate the value of the column mapped by
the annotated property. The expression is included in generated SQL
| |
| value | back to summary |
|---|---|
| public GenerationTime value()
Specifies the events that cause the value to be generated by the database.
| |
| writable | back to summary |
|---|---|
| public boolean writable() Determines if the value currently assigned to the annotated property
is included in SQL
Often used in combination with
| |