Row was updated or deleted by another transaction in trashcan
Items mapped by cascade="delete" may result in exception when deleting them from the trashcan
The scenario is this: We have items A and B of two different types. B is a child item to A and the mapping is such that if A is deleted then B is deleted by cascade. Ie. The relation is mapped with cascade="delete" in the mapping file.
Now, we have flagged both A and B for deletion and use the trashcan to delete them. The actual order of deletion is not known, so it might be that B is deleted before A. Then when A is about to be deleted Hibernate follows the cascade and tries to delete B again. Since, B has already been deleted this results in an exception like the following:
In this case the Message was connected to a Job which cascade deletes all messages linked to the job. Ie. the job is the A item and the message is the B item.
I think this could be a bug in Hibernate which should *know* the best deletion order. Since every action is put into the Hibernate cache and isn't executed until a commit() is called it is uncertain if a changed deletion order on our side will change this behaviour.