Missing audit entries on bulk/batch insert (with hibernate)
983889Jan 10 2013 — edited Jan 10 2013I've a Java/Hibernate/Spring application with oracle's audit (11g non-clustered) enabled, and it seems to be properly configured, on db-extended mode.
However, some entries are not being written to SYS.AUD$.
Here's my scenario:
I've a transaction which performs 8 inserts on Oracle, which are shown by hibernate's showsql, and are in fact written into the DB.
I've an AUDIT INSERT RULE BY ACCESS for the given table, and, I expected to see the 8 audit entries on Oracle's AUDIT for the given transaction, but i got only 4 inserts logged. Sometimes, 5 entries are logged, and sometimes 3, tough.
I've managed to track down that this behavior is related to hibernate.jdbc.batch_size property value.
In the described scenario the value was set to 10.
If I change the value to 0 however, which disables jdbc batching, everything works just as expected and I always get the 8 insert audit logs.
I thought it could be a bug on ojdbc driver, but the bug persisted even after I upgraded to the latest version.
Disabling jdbc batch is not an option for me. Is it a bug ? Any thoughts on how to overcome this?