-->
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.  [ 2 posts ] 
Author Message
 Post subject: Lifecycle method to update second column based on pkey
PostPosted: Tue Dec 27, 2005 6:23 pm 
Beginner
Beginner

Joined: Thu Apr 15, 2004 2:01 pm
Posts: 25
Hello

I want to do the following. How can I achieve this implementing Lifecyle on domain object?

I insert a transaction record. Based on Id generated for this record, I want to update second column in that record with same id concatenated with some text. How can I achieve this using Lifecycle onSave?

Id (Primary key) is sequence generated for this table.

my object is like this :
Item has Id and Ref no.
I call session.save(item).
Once item is saved, I want to update Refno with "date"+item_id generated for this record.

Thanks in advance


Top
 Profile  
 
 Post subject: Listeners
PostPosted: Tue Dec 27, 2005 7:15 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
You will need to implement a listener to do what you need and register the listener in the H configuration:
http://www.hibernate.org/hib_docs/v3/re ... ate-events

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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

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.