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,然后看下頁面發(fā)現(xiàn)是N_SEQ_NO有4個重復,刪除多余的記錄即可保存成功。