5.6. Generated Properties
Generated properties are properties which have their values generated by the database. Typically, Hibernate applications needed to refresh
objects which contain any properties for which the database was generating values. Marking properties as generated, however, lets the application delegate this responsibility to Hibernate. Essentially, whenever Hibernate issues an SQL INSERT or UPDATE for an entity which has defined generated properties, it immediately issues a select afterwards to retrieve the generated values.
insert
- states that the given property value is generated on insert, but is not regenerated on subsequent updates. Things like created-date would fall into this category. Note that even thought
Section 5.1.7, “version (optional)” version and
Section 5.1.8, “timestamp (optional)” timestamp properties can be marked as generated, this option is not available there...