Hibernate version: 2.1.8
Name and version of the database you are using: FirstSQL 2.75
Converted our Swing-Based Desktop Publishing app to use Hibernate. Not only did lots of JDBC code go away, our object model is much cleaner now, and we're seeing noticeabe performance gains. Kudos for a great framework and a great book.
Now on to my question:
I'm looking for a way to have Hibernate nullify certain entity Ids after the entity has been deleted via cascade. For reasons not worth detailing here, it is not (elegantly) possible to null these values explicitly subsequent to the delete, as the references to the deleted objects are no longer conveniently available.
After experimenting with the onDelete() and postFlush() methods in the Interceptor interface, I have determined that this can not be easily be accomplished via callback in Hibernate 2.1.8.
Under Hibernate3, I see that there is a PostDeleteEventListener. This looks like it could be a perfect fit. I do plan on upgrading to Hibernate3 soon, but not for a couple weeks at least.
In short:
Is it possible to automatically null the id (and possibly ids of children) of an entity deleted via cascade under Hibernate 2.1.8?
Similarly, how could this same question be addressed in Hibernate3?
Thanks,
Thom
|