Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,19 @@
* the defaulted value of a database column.
* </ul>
* <p>
* For example, this field will be populated with the value {@code "new"} by
* the database when the entity is inserted:
* <pre>
* &#064;Generated &#064;ColumnDefault(value = "'new'")
* private String status;
* </pre>
* <p>
* If {@code @Generated} is not used, a {@code default} value can cause state
* held in memory to lose synchronization with the database.
*
* @author Steve Ebersole
*
* @see Generated
* @see GeneratedColumn
* @see DialectOverride.ColumnDefault
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@
* 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.
* <p>
* The {@link ColumnTransformer} annotation is an alternative in certain cases, allowing
* the use of native SQL to read <em>and write</em> values to a column.
* The {@link ColumnTransformer @ColumnTransformer} annotation is an alternative in
* certain cases, allowing the use of native SQL to read <em>and write</em> values to
* a column.
* <pre>
* // it might be better to use &#64;ColumnTransformer in this case
* &#064;Formula("decrypt(credit_card_num)")
* String getCreditCardNumber() { ... }
* </pre>
*
* @see Generated
* @see ColumnTransformer
* @see DiscriminatorFormula
* @see JoinFormula
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,16 @@
* <ul>
* <li>a database table has a column value populated by a database trigger,
* <li>a mapped column has a default value defined in DDL, in which case
* {@code @Generated} is used in conjunction with {@link ColumnDefault},
* {@code @Generated} is used in conjunction with the
* {@link ColumnDefault @ColumnDefault} annotation,
* <li>a {@linkplain #sql() SQL expression} is used to compute the value of
* 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, or
* <li>there is no mapped column, and the value of the field is determined
* by evaluating a SQL {@link Formula}.
* by evaluating a SQL {@link Formula @Formula}.
* </ul>
* <p>
* On the other hand:
Expand Down