-->
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: EntityListener Does Not Work
PostPosted: Fri Dec 09, 2005 10:02 am 
Newbie

Joined: Thu Dec 01, 2005 12:23 pm
Posts: 19
Hi there,

I'm trying to get an entity listener to run, but without success. The problem seems to be that the listener class does not get loaded.

I've tried to get the following example to run: http://docs.jboss.org/ejb3/app-server/tutorial/callbacks/callbacks.html which is from a JBoss tuturial.

I did not change anything in the example except for the package name. When I run a test case that persists an entity of type Customer, I'd expect to receive the log output from the callback listener class as described in the example. But no output is generated, although the Customer has been persisted successfully. :(

So I added a static block to the CustomerCallbackListener that simply throws an IllegalArgumentException. As even this exception does not appear in the log output, it seems the callback listener does not get loaded.

Is there anything special I have to do to get the callback listener to run? Are those callback listeners supported in Hibernate?

I'm using Hibernate 3.1rc2 with Hibernate-Annotations 3.1beta6 on Windows XP.

Would be grateful for any hints!

- bitbyter


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 10, 2005 1:34 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
weird,
This test pass http://cvs.sourceforge.net/viewcvs.py/h ... &view=auto

Try to start from it an chenge it until you get your 'failing' config

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 11, 2005 2:12 pm 
Newbie

Joined: Thu Dec 01, 2005 12:23 pm
Posts: 19
emmanuel wrote:
weird,
This test pass http://cvs.sourceforge.net/viewcvs.py/h ... &view=auto

Try to start from it an chenge it until you get your 'failing' config


Thanks for the hint. It seems @EntityListener annotation only works with Hibernate Entity Manager and not with standard Hibernate. Is there a reason for this? Standard Hibernate offers event listeners which are very similar, thus i guess it wouldn't be that hard to implement this. Would it?

- bitbyter


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 11, 2005 2:21 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
The Hibernate event listener is much more open and sophisticated than the EJB3 one. Actually the EJB3 event listeners are implemented using the Hibernate ones.

You can probably use them in plain hibernate but you'll need to do the init phase yourself. check EventListenerConfigurator in HEM, this is exactly what this piece of code does.

_________________
Emmanuel


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.