PCIS[2010-07-08 18:08:02,531]>>
ERROR>> [BizControllerImpl异常堆栈{事务ID/用户代码}:[1278583679437325]/[00000210]:com.fwk.service.BusinessServiceException: com.fwk.dao.DaoException: 保存保单,
saveOrUpdatePolicy()时出错; nested exception is org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at com.pcis.policy.dm.PolicyDAO.saveOrUpdatePolicy(PolicyDAO.java:193)
at com.pcis.policy.app.newbusiness.service.PolicyAppService.savePolicy(PolicyAppService.java:343)
at com.pcis.policy.app.underwrite.bm.UnderwriteBM.submitUnderwrite(UnderwriteBM.java:139)
at com.pcis.policy.app.underwrite.action.UnderwriteBizAction.submitUnderwrite(UnderwriteBizAction.java:548)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
...
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
分析及解决:
在页面保存的时候,后台提示是违反唯一索引,通过UI_PLY_CVRG 查询相应的表,
select * from user_indexes where index_name='UI_PLY_CVRG'
该表是WEB_PLY_CVRG ,而该表的唯一索引UI_PLY_CVRG 是由该表的3个字段组成
C_PLY_NO、N_EDR_PRJ_NO、 N_SEQ_NO,然后看下页面发现是N_SEQ_NO有4个重复,删除多余的记录即可保存成功。