Skip to content

Commit cc39f82

Browse files
Calculate Entity Persistent Property
1 parent 729f411 commit cc39f82

File tree

1 file changed

+2
-0
lines changed
  • HibernateSpringBootCalculatePropertyGenerated

1 file changed

+2
-0
lines changed

HibernateSpringBootCalculatePropertyGenerated/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
**Description:** This application is an example of calculating an entity persistent property at `INSERT` and/or `UPDATE ` time via Hibernate, `@Generated`.
44

55
**Key points:**\
6+
67
**Calculate at `INSERT` time:**
78
- annotate the corresponding persistent field with `@Generated(value = GenerationTime.INSERT)`
89
- annotate the corresponding persistent field with `@Column(insertable = false)`\
@@ -12,6 +13,7 @@
1213
- annotate the corresponding persistent field with `@Column(insertable = false, updatable = false)`
1314

1415
**Further, apply:**\
16+
1517
**Method 1:**
1618
- if the database schema is generated via JPA annotations (not recommended) then use `columnDefinition` element of `@Column` to specify as an SQL query expression the formula for calculating the persistent property\
1719

0 commit comments

Comments
 (0)