Currently we are getting following exception during deletion of records from a particular table. I went through many blogs and forums and I came to know that its happening because from DB we are deleting 2 duplicate records but hibernate is expecting 1 record to be deleted. Please correct me if I am wrong.
We thought this issue will be reolved with Oracle 12c Release 2. But even after upgrading Oracle we are still facing this issue.
If you can provide a solution for this isuee it will be very helpful.
Exception :
org.springframework.orm.hibernate3.HibernateSystemException: Batch update returned unexpected row count from update [0]; actual row count: 2; expected: 1; nested exception is org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned unexpected row count from update [0]; actual row count: 2; expected: 1
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:690)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:103)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
at org.springframework.orm.jpa.JpaAccessor.translateIfNecessary(JpaAccessor.java:155)
at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:192)
at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:150)
Oracle DB version : Oracle 12c Release 2
Driver version : 11.2
OJDBC Jar : ojdbc6-11.2.0.3
Hibernate Version : 4.1.7
Reference : Oracle JDBC batchUpdate rows affected is always -2 (Statement.SUCCESS_NO_INFO)