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
|