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.  [ 3 posts ] 
Author Message
 Post subject: How to create an 'onChange trigger'?
PostPosted: Wed Aug 27, 2008 12:35 pm 
Newbie

Joined: Tue May 27, 2008 12:35 pm
Posts: 8
Hibernate version: 3.3

Name and version of the database you are using: SQL Server 2005

Hello,
I've been struggling with this forever and thought it was about time to just ask someone.
I want to trigger a JMS message when a property value on a persistent object is changed and committed to the database. I'd much rather do this in Hibernate than a database trigger.
Anyway, this seems like it would be fairly trivial, but I've looked at the various event/trigger systems available with Hibernate and some other approaches, but I'm just not seeing how to do it.
Ideally, along with the trigger notification of a property value being changed, I would also send the old value along with the new value... but I may be able to do without this.

Please, any suggestions? The ability to do this would help me tremendously.

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 27, 2008 2:00 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Have you tried using an Interceptor? For documentation see http://www.hibernate.org/hib_docs/v3/ap ... eptor.html
and http://www.hibernate.org/hib_docs/v3/re ... vents.html

Implementing the Interceptor.onFlushDirty() method may help solving your problem.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 15, 2008 11:46 pm 
Newbie

Joined: Tue May 27, 2008 12:35 pm
Posts: 8
Thanks a bunch. This looks like what I need.


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