Hello, I have to change the way that I generate the ids and I have to now if Hibernate can help me.
In the past I had to generate the Ids (to record of contracts) in sequence. Then I used MS-SQL with Identity and with the following configuration everything works fine:
Code:
<id
name="id"
column="id"
type="java.lang.Long"
unsaved-value="null">
<generator class="native"></generator>
</id>
But now I have a new requirement to generate the Ids, the new id have this form: YYXXXX, where
YY is two digit of the contract year ("04" for 2004) and XXXX is contract sequence number (starts with 0001 for that year).
So 030001 is the first contract of year 2003, 030002 is the second contract of year 2003 and 040001 is the first contract of year 2004.
Is there a way to hibernate help me to generate the sequence of this ids?
Thanks in advance, Claudio.