Hi,
I am facing a problem with Hibernate. The problem statement is as follows:
The table structure is:
Column Type Type
name schema name Length Scale Nulls
------------------------------ --------- ------------------ -------- ----- ------ -----------------------------------------------
I_WINET_ID SYSIBM BIGINT 8 0 No ---PK
C_PROPERTY_CODE SYSIBM VARCHAR 10 0 No --- PK
D_START SYSIBM TIMESTAMP 10 0 No ----- PK
I_SEQUENCE_NUMBER SYSIBM BIGINT 8 0 No
Now, there are 27 possible values for Property Code field.
When a new row is to be inserted into the table, depending on the property code , the value of the Sequence Number field should be set to the next value of a sequence.
For eg the insertion will be :
winetId, property code, d_start, sequence no
124587 AKC (current timestamp) 1 ---------
-- 1st record for AKC… therefore seq : 1
214578 RLV (current timestamp) 1 ----------
- 1st record for RLV ….. therefore seq: 1
212548 AKC (current timestamp) 2 -----------
2nd record for AKC ….. therefore seq: 2
548789 AKC (current timestamp) 3 -----------
3rd record for AKC ….. therefore seq: 3
875445 RLV (current timestamp) 2 -----------
2nd record for RLV ….. therefore seq: 2
I thought of creating different sequences for the possible values of propertyCode…but, Hibernate doesn’t give us control of a sequence ( as in we cannot specify which sequence to apply on what condition). Also, I think it does not allow to map a sequence with a non primary key.
We are using Hibernate 2.1.7
Any pointers as how to solve this?
_________________ ----- Nagarajan.
|