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.
Properties marked as generated must additionally be non-insertable and non-updateable. Only Section 5.1.7, “version (optional)” versions, Section 5.1.8, “timestamp (optional)” timestamps, and Section 5.1.9, “property” simple properties can be marked as generated.
never (the default) - means that the given property value is not generated within the database.
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...
always - states that the property value is generated both on insert and on update.