If anyone can shed some light on this, it would be greatly appreciated.
Does anyone know how hibernate behaves when session.flush is called within a session.flush? We are currently using the post-insert event which in turn ends up calling a flush.
For instance, the scenario is this:
1. Create an aggregate of entities
2. Call session.save
3. Call session.flush
4. An entity is persisted
5. The post-insert event fires
6. The post-insert event calls a DAO which does a session.flush
This is resulting in duplicate insert statements for one of the entities in the object graph and thus db constraint violations.
My theory is that since the second flush is within the first flush the queued DML is never marked as completed and hibernate tries to run it again. Any thoughts out there?
|