[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3904) Veto by Pre-Event Listeners does not work properly.

Rupesh Kumar (JIRA) noreply at atlassian.com
Thu May 7 11:16:13 EDT 2009


Veto by Pre-Event Listeners does not work properly.
---------------------------------------------------

                 Key: HHH-3904
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3904
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.1
         Environment: Hibernate 3.3.1
Any DB
            Reporter: Rupesh Kumar


As per the API of PreInsert/Update/DeleteEventListeners, if it returns "true", the operation should be aborted. However, the behavior I see is and I can confirm from the hibernate source as well is - the operation does get aborted but then it proceeds to call the post events and then it tries to proceed further resulting in some assertion error. So there are two issues here
-  Post Events get called even though the operation does not happen.
- If the pre* callbacks return true, it leads to some exception. Here is the stacktrace for Insert
org.hibernate.AssertionFailure: null identifier
               at org.hibernate.engine.EntityKey.<init>(EntityKey.java:61)
               at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:325)
               at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
               at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
               at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
               at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
               at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117)
               at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
               at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:534)

In the hibernate source 3.3.1 -> take a look at org.hibernate.action.EntityIdentityInsertAction.execute():65
It gets the veto result back and inserts only if veto was false. however it then calls postInsert() irrespective of veto value. 
Since this was triggered by ActionQueue.execute(), the veto information could not be propagated back and hence AbstractSaveEventListener tries to proceed ahead and finally throws up error.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list