I am using hibernate auditions with hibernate version 3.5. while it is working fine when I try to insert single record in one table in one transation but the problem is when a "BATCH" runs and it inserts multiple records in one table in single transation then single "rev id" is being generated for audit tables which causes "integrityconstraintsviolation".
As it is the normal behavior of hibernate that all the insert queries are fired at the end of tansaction(When it flushes) but at this time only one query is being fired for "rev id" generation.
select hibernate_sequence.nextval from dual;
Kindly tell me whether is it a bug in audit or i am missing something ?? Thanks in advance
A revid always span modifications in multiple tables!
Yes, the inserts are called at the end of the transaction, but: If you use optimistic transaction isolation, a transaction can read the uncommitted state of another transactions that are currently active but not yet committed.
If you become a integrityconstraintsviolation the column
rev_id
is unfortunatelly configured "unique". This is a wrong database schema! Correct the schema by removing the Uniqueness of the columnrev_id
!The
rev_id
-Column in the global-hibernate-relationtable must be unique because it is a Primary-Key! (the global-hibernate-relationtable usually contains also a timestamp).