-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate 4 and event listeners
PostPosted: Thu Dec 29, 2011 4:53 am 
Newbie

Joined: Thu Dec 29, 2011 4:44 am
Posts: 3
Hello.

I'm trying to use Hibernate 4 for a new project, but I found that the documentation is incorrect on some aspects. One of that is how to programmatically add event listeners, the documentation says to call cfg.EventListeners().setLoadEventListeners(stack); but, as far as I can tell, there is no EventListener method on Configuration (nor getEventListener not anything that resembles such behaviour).

I readed that Hibernate 4 migrated some stuff as services and found some code, mainly in the issue tracker, but all code I tried do not work, I get null pointer exceptions from weird places and it doesn't tell anything about what's wrong or how to do things right.

So, can anyone post a sample code on how to programmatically initialize an Hibernate 4 environment, including postCreate/Modify/Delete event listeners ?

Thanks.


Top
 Profile  
 
 Post subject: Re: Hibernate 4 and event listeners
PostPosted: Tue Jan 03, 2012 9:51 am 
Newbie

Joined: Fri Jun 17, 2005 2:07 am
Posts: 19
Location: Berne, Switzerland
hi,

did you manage to add your listeners in the configuration xml ?

i tried the following configuration (works with hibernate 3.6.4):

<event type="pre-insert">
<listener class="my.test.PreInsertEventListener"/>
</event>

but my listeners were not called.

jakob


Top
 Profile  
 
 Post subject: Re: Hibernate 4 and event listeners
PostPosted: Thu Jan 05, 2012 9:45 am 
Newbie

Joined: Thu Dec 29, 2011 4:44 am
Posts: 3
I don't use configuration files so I can't confirm if it works or not (and I have reverted my project to Hibernate 3.6.9 so I can't even give it a try).


Top
 Profile  
 
 Post subject: Re: Hibernate 4 and event listeners
PostPosted: Fri Jan 06, 2012 6:39 pm 
Newbie

Joined: Fri Jun 17, 2005 2:07 am
Posts: 19
Location: Berne, Switzerland
opened a bug report
https://hibernate.onjira.com/browse/HHH-6945


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