-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Assign key value to a new column
PostPosted: Mon Jun 01, 2009 2:52 pm 
Newbie

Joined: Sun Jan 11, 2009 12:43 pm
Posts: 3
Hello Everyone,

I have the below mapping in my .hbm file.

<hibernate-mapping>
<class name="Activity" table="ACTIVITY_TABLE" lazy="true" discriminator-value="A">
<id name="activityNo" type="long">
<column name="ACTIVITY_NO" precision="8" scale="0" />
<generator class="sequence">
<param name ="sequence">SEQ_ACTIVITY_TABLE</param>
</generator>
</id>
</hibernate-mapping>

In my code I will populate the activity object and after calling the flush() method, data is stored in the table with the generated activity number. I have created a new column called ACTIVITY_ORDER in the table.
The requirement is after calling the flush method, I need to assign the generated ACTIVITY_NO value to ACITIVY_ORDER.

I tried assigning the value with the below mapping but doesn't work.

<property name="activityOrder" type="long" formula="nvl(ACTIVITY_ORDER,ACTIVITY_NO)">
<column name="ACTIVITY_ORDER" precision="8" scale="0" />
</property>

Thanks,
Yaragalla


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.