I have this table on Sql Server
- id int
- journal_date datetime
- sequence int
What im trying to do is generate a sequence based on the datetime value.
example of the database
| id | journal_date | sequence |
--------------------------------
| 1 | 2012-01-01 | 1 |
| 2 | 2012-01-01 | 2 |
| 3 | 2012-01-02 | 1 |
| 4 | 2012-01-01 | 3 |
How to do this on hibernate model and the annotations ?
to fill up the sequence column the first time
and to keep it in sync either use a trigger with
or handle it in Code using Hibernate