|
From: Max R. A. <max...@jb...> - 2004-12-07 12:56:38
|
On Tue, 7 Dec 2004 17:05:17 +0530, Vipul Gaba <vip...@bl...> wrote: > 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 > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel -- Max Rydahl Andersen callto://max.rydahl.andersen Hibernate ma...@hi... http://hibernate.org JBoss Inc max...@jb... http://jboss.com |