|
I'm using Hibernate 3.3.2.GA and I have a question on PostInsertEventListener. I'm using it to produce a report that has a foreign key to the entity that is listening for the event.
Unfortunately this doesn't work as I'd expected because the entity has not been inserted yet and I get a integrity constraint violation. I only see the insert statement go through _after_ the PostInsertEventListener is notified.
Am I missing something? Shouldn't the entity have been inserted _before_ the listener is notified?
I then tried to use the postCommitInsert, but as the name implies, it's called after the commit, and I want to insert the report in the same transaction.
What are my options? What do I need to do to get a callback after the insert actually happens?
Thanks.
|