-->
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.  [ 5 posts ] 
Author Message
 Post subject: how to simulate db triggers
PostPosted: Sun Feb 29, 2004 6:34 am 
Regular
Regular

Joined: Fri Jan 16, 2004 4:48 am
Posts: 56
Hi,

I need to post insert /update/delete record in a table based on every insert /update/delete on some other tables.

How can I do it here. . I have looked at the intercepor methods...the only method that comes close to what I am looking is the postFlush. However, no entiry is passed on deletes. Also, I am not sure if the Interceptor will go in a loop as I am again inserting a record which will involve a flush.

Would appreciate any hint/info.

Thanks
Shishir


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 29, 2004 9:41 am 
Regular
Regular

Joined: Mon Nov 24, 2003 6:36 pm
Posts: 105
Why not just map the other table as a hibernate managed entity, and create/update save it as part of a hibernate transaction?

--James


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 29, 2004 10:45 am 
Newbie

Joined: Wed Sep 24, 2003 7:37 am
Posts: 6
Location: Bologna (ITALY)
I think that the Lifecycle interface could be used in order to achieve "trigger-like" functionality.

Mauro.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 29, 2004 11:06 am 
Regular
Regular

Joined: Mon Nov 24, 2003 6:36 pm
Posts: 105
one more thing... not sure if you realize, but you can always get a handle to the underlying connection, and fire some jdbc at the db using
sess.connection() method. Possibly this might fit what you're trying to do.
James


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 29, 2004 2:49 pm 
Regular
Regular

Joined: Fri Jan 16, 2004 4:48 am
Posts: 56
Yup, I can do all that. The reason I was looking at the interceptor way of doing it is that there is a core data model for which the mappings and the classes have been defined. There is another variance of the data model that has the requirement as I stated. I was looking atsome kind of plugable feature rather than changing the core code. Something like intercepor , pointcut advice .... which I can just add in a declarative mode and remove when not needed.

Thanks
Shishir


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.