I have a table lets say with following fields:
id (which is primary key and of identity type) id2 (which is a normal column with lets say int data-type)
In the mapping xml for this table, I am using "identity" algorithm for automatic generation of "id" column.
Now the primary key "id" will be generated automatically whenever a new row
is inserted into this table. Alongwith the generation of id, I also want id2
to get generated automatically through hibernate. Is that possible ? Can we
use some pre-defined algorithm for the generation of a non-primary key
column in xml or something like that ?
just do that in your class constructor.
this.id2 = getSomeUniqueValueFromWhereEver();
..or you could probably write your own UserType which could manage this.
p.s. use the forums for user related questions.
/max
Regards, ________________________________________________________________ Vipul Gaba TechSpan India Pvt. Ltd. 301, Raheja Chancery, 133, Brigade Road, Bangalore 560025 INDIA Tel. +91.80.22129560 x 2201 Mob. +91.9886272832
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
-- Max Rydahl Andersen callto://max.rydahl.andersen
Hibernate [EMAIL PROTECTED] http://hibernate.org
JBoss Inc [EMAIL PROTECTED] http://jboss.com
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel