Hi,
I am trying to insert a row in the audit table when an object of table T is being created. I create a PostInsert Event listener and try to do the auditing in the onPostInsert() method.
I am see the onPostInsert() method being triggered when the new object of table T is committed. However, when I flush my new object in the onPostInsert() method, I am gettiing a Primary Key violation on the newly created table T object. I am guessing the flush will try to flush the table T object again, and thus causng the primary key violation.
How can I solve this problem?
Any help will be highly appreciated.
|