-->
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.  [ 1 post ] 
Author Message
 Post subject: Fire Hibernate custom event listener before default ones
PostPosted: Fri Jun 03, 2011 9:35 am 
Newbie

Joined: Fri Jun 03, 2011 9:33 am
Posts: 1
Hi gurus!

I made a custom Hibernate Event listener extending org.hibernate.event.PreInsertEventListener. The custom listener overrides onPreInsert method and sets a field of a "Contact" entity before saving it in DB with a DAO.

Problem is, the field was null before the listener gives it a value and default hibernate event listeners are automatically triggered BEFORE my custom listener. As they check the ddl, they see the not-null constraint on the field and throw a null check exception before letting my custom event listener give the field its value. (same problem happens when using spring AOP instead of hibernate custom listeners: the default hibernate listener is executed before my aspect method)

So, it is possible to tune the triggering order of the hibernate listeners knowing that I use a spring session factory ?

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.