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: [Performing equivalent to a triggerOnSave]
PostPosted: Tue Mar 16, 2004 2:53 am 
Beginner
Beginner

Joined: Wed Mar 03, 2004 6:02 am
Posts: 46
Location: Kuala Lumpur, Malaysia
Hello,

Vital stats: Hibernate 2.1.2, MySQL 4.0.18

When I save an entity to the Db, I would like to run something equivalent to a INSERT TRIGGER, in order to create a related record in another table. I could do this serially.
Code:
session.save( a );
session.refresh ( a );

B relatedEntity = new B();
relatedEntity.setParent( a );
relatedEntity.setStatus( "foo" );
session.save( relatedEntity );

However, I want something like a post execution method to run once a has been saved.
How can I achieve this in Hibernate ?

Regards,

Alistair


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 10:15 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
LifeCycle interface will do the job.

_________________
Emmanuel


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.