File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
hibernate-core/src/main/java/org/hibernate/annotations Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 22
22
* the defaulted value of a database column.
23
23
* </ul>
24
24
* <p>
25
+ * For example, this field will be populated with the value {@code "new"} by
26
+ * the database when the entity is inserted:
27
+ * <pre>
28
+ * @Generated @ColumnDefault(value = "'new'")
29
+ * private String status;
30
+ * </pre>
31
+ * <p>
25
32
* If {@code @Generated} is not used, a {@code default} value can cause state
26
33
* held in memory to lose synchronization with the database.
27
34
*
28
35
* @author Steve Ebersole
29
36
*
37
+ * @see Generated
30
38
* @see GeneratedColumn
31
39
* @see DialectOverride.ColumnDefault
32
40
*/
Original file line number Diff line number Diff line change 45
45
* a formula may involve columns of the primary table, or columns of any one of the
46
46
* secondary tables. But it may not involve columns of more than one table.
47
47
* <p>
48
- * The {@link ColumnTransformer} annotation is an alternative in certain cases, allowing
49
- * the use of native SQL to read <em>and write</em> values to a column.
48
+ * The {@link ColumnTransformer @ColumnTransformer} annotation is an alternative in
49
+ * certain cases, allowing the use of native SQL to read <em>and write</em> values to
50
+ * a column.
50
51
* <pre>
51
52
* // it might be better to use @ColumnTransformer in this case
52
53
* @Formula("decrypt(credit_card_num)")
53
54
* String getCreditCardNumber() { ... }
54
55
* </pre>
55
56
*
57
+ * @see Generated
56
58
* @see ColumnTransformer
57
59
* @see DiscriminatorFormula
58
60
* @see JoinFormula
Original file line number Diff line number Diff line change 42
42
* <ul>
43
43
* <li>a database table has a column value populated by a database trigger,
44
44
* <li>a mapped column has a default value defined in DDL, in which case
45
- * {@code @Generated} is used in conjunction with {@link ColumnDefault},
45
+ * {@code @Generated} is used in conjunction with the
46
+ * {@link ColumnDefault @ColumnDefault} annotation,
46
47
* <li>a {@linkplain #sql() SQL expression} is used to compute the value of
47
48
* a mapped column,
48
49
* <li>a custom SQL {@link SQLInsert insert} or {@link SQLUpdate update}
49
50
* statement specified by an entity assigns a value to the annotated
50
51
* property of the entity, or {@linkplain #writable transforms} the
51
52
* value currently assigned to the annotated property, or
52
53
* <li>there is no mapped column, and the value of the field is determined
53
- * by evaluating a SQL {@link Formula}.
54
+ * by evaluating a SQL {@link Formula @Formula }.
54
55
* </ul>
55
56
* <p>
56
57
* On the other hand:
You can’t perform that action at this time.
0 commit comments