[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4143) PostRemove being called before entity is actually deleted

Matt York (JIRA) noreply at atlassian.com
Mon Nov 30 18:23:10 EST 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34823#action_34823 ] 

Matt York commented on HHH-4143:
--------------------------------

I've also seen this issue. I have an EventListener with a method annotated with @PostRemove, this method removes files from the file system when an Entity is deleted. 

In cases where the delete fails due to a foreign key constraint an Exception is thrown and the transaction is rolled back, but the files are still deleted showing that the postRemove method was called. Inspection of the logs shows that this is the case and appears to indicate that the postRemove method is called before the transaction is rolled back.

> PostRemove being called before entity is actually deleted
> ---------------------------------------------------------
>
>                 Key: HHH-4143
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4143
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: entity-manager
>         Environment: Hibernate 3.2.1GA Entity Manager
> Hibernate core 3.2.2 GA
> Oracle 9i
> Windows XP professional service pack 2
> No application server is being used. 
>            Reporter: Paul
>
> I have an EntityListener with a method annotated with postremove.  It seems that the method is being called before the actual entity is deleted from the database. When configuring log4j with "debug" logging it appears that the method is being called after the PreparedStatement is created and configured but before executeUpdate() is called. 
> I see the following statements in my log file before my listener is called
> 14:06:27,024 DEBUG AbstractBatcher:476 - preparing statement
> 14:06:27,024 DEBUG IntegerType:133 - binding '59532' to parameter: 1
> My listener is  called next. Then, the prepared statement is executed. 
> This violates the EJB3 spec. The EJB3 spec states "The PostPersist and PostRemove methods will be invoked after the
> database insert and delete operations respectively."

-- 
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