Hi,
This is my first time on this forum. Hope to get some solution to a small problem I am facing with Hibernate.
I have a Oracle table (lets say T) whose primary key is, lets say, P. While storing records in this table I use the <generator> for "P", which uses oracle's "sequence". This works fine.
In this table, I have to add another column, lets say Q. Although this new column will hold unique values for each record (and behaves like a primary key), yet it should not to be part of any key in "T". So far so good.
But my problem starts now:
1. Column Q should be "sequence" driven. I have created a new sequence for this. But I don't know how to use this sequence in the <property>. I am not sure if two sequence generators (one for P and one for Q) are allowed in one mapping xml. I need help here.
2. Column Q's final value should be a "function" of this new sequence. This new sequnce will return a numeric value (everytime unique). Using this unique number I have to create a unique string and then store that string value in the Q column. Again, I don't know how to do this and need help.
note: I have the logic available for this function. All I need to know is "can I", and "how to" use it in hbm mapping document ?
Thanks,
Sumit
|