Jdbc异常:Could not execute JDBC batch update

今天在项目中最Hibernate保存的时候,出现以下异常:

Caused by: org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

 at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:624)
 at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
 at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:379)
 at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:841)
 at com.fwk.dao.BaseDao.flush(Unknown Source)
 at com.pcis.policy.dm.PolicyDAO.saveOrUpdatePolicy(PolicyDAO.java:174)
 ... 80 more

Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (PCISV6_TS.UI_PLY_CVRG) violated
 at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:602)
 at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9350)
 at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:210)
 at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
 at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
 at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
 ... 90 more

造成以上异常的原因如下:

在页面保存的时候,后台提示是违反唯一索引
删除多余的记录即可保存成功。

你可能感兴趣的:(Exception异常收集)