-->
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: Pre-/PostUpdateEvents <- How to use the listener
PostPosted: Sat May 03, 2008 4:50 am 
Beginner
Beginner

Joined: Wed Apr 23, 2008 12:07 pm
Posts: 22
Quote:
The idea is to implement a PreUpdateEventListener that creates a "backup" of the old object state before doing the actual update. The easiest approach is to use the "oldState" fields, supplied by the PreUpdateEvent to create this "historical" new entry


Trying to google it, trying to search all the forum inside here. Seems that many users already use these Pre and Post Update/Insert...Events. And I would like that, too. But I simply canĀ“t find any piece of source that shows how to "register" the listener in a session or what to do that fires this event!? I dont have any hibernate.cfg.xml, just a persistence.xml and I am working with the EntityManager. I would be glad if anyone can help me out :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 04, 2008 3:53 pm 
Pro
Pro

Joined: Tue Jun 12, 2007 4:13 am
Posts: 209
Location: Berlin, Germany
Hi Abram,

you can do it in "persistence.xml" like this:
Code:
<property name="hibernate.ejb.event.pre-insert" value="org.hibernate.validator.event.ValidateEventListener" />
<property name="hibernate.ejb.event.pre-update" value="org.hibernate.validator.event.ValidateEventListener" />


Carlo
----------------------------------
please give me credits if this post helped you


Top
 Profile  
 
 Post subject: Re: Pre-/PostUpdateEvents <- How to use the listener
PostPosted: Sun Nov 21, 2010 5:30 pm 
Newbie

Joined: Tue May 18, 2010 5:39 am
Posts: 19
I have described how pre event listeners work in my blog http://anshuiitk.blogspot.com/2010/11/h ... event.html. These are just the basic concepts. Configurations you can find easily on the hibernate documentation. Let me know if I can answer more.

_________________
AG
http://anshuiitk.blogspot.com


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.