HHH-18809 update Javadoc with this usage

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-11-04 22:10:21 +01:00
parent e4b52c2cf1
commit 7fec477bc2
2 changed files with 15 additions and 4 deletions

View File

@ -32,6 +32,15 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* Character middleInitial;
* </pre>
* <p>
* By default, the fields of an entity are not updated with the results of evaluating
* the formula after an {@code insert} or {@code update}. The {@link Generated @Generated}
* annotation may be used to specify that this should happen:
* <pre>
* &#64;Generated // evaluate the formula after an insert
* &#64;Formula("sub_total * (1.0 + tax)")
* BigDecimal totalWithTax;
* </pre>
* <p>
* For an entity with {@linkplain jakarta.persistence.SecondaryTable secondary tables},
* a formula may involve columns of the primary table, or columns of any one of the
* secondary tables. But it may not involve columns of more than one table.

View File

@ -31,11 +31,13 @@ import static org.hibernate.generator.EventType.INSERT;
* <li>a mapped column has a default value defined in DDL, in which case
* {@code @Generated} is used in conjunction with {@link ColumnDefault},
* <li>a {@linkplain #sql() SQL expression} is used to compute the value of
* a mapped column, or
* <li>when a custom SQL {@link SQLInsert insert} or {@link SQLUpdate update}
* a mapped column,
* <li>a custom SQL {@link SQLInsert insert} or {@link SQLUpdate update}
* statement specified by an entity assigns a value to the annotated
* property of the entity, or {@linkplain #writable() transforms} the
* value currently assigned to the annotated property.
* property of the entity, or {@linkplain #writable transforms} the
* value currently assigned to the annotated property, or
* <li>there is no mapped column, and the value of the field is determined
* by evaluating a SQL {@link Formula}.
* </ul>
* <p>
* On the other hand: