Hi, I'm having a problem with a legacy app that uses SQLServer 2000 that we're converting to EJB3. One of the tables has a trigger on it to record audit changes. However, the way the trigger and the audit repository work is, it creates a new record for each changed field in the target table. Two fields are always updated (last update time, and user) so changing even one field causes hibernate to think three records were updated instead of the expected one record.
I get the following exception:
org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned unexpected row count from update ; actual row count: 3; expected: 1
I think the hibernate engine is using @@rowcount to get the number of updated rows, but the trigger messes this up.
The database folks aren't much interested in changing their auditing practice :-( so I'm wondering if there's a way to change the hibernate configuration to deal with this.
Any suggestions? TIA,