捕获“ORA-00001: 违反唯一约束条件”异常并抛出业务相关的错误信息
1.背景:T表F字段唯一索引,保存F字段重复的数据后台异常(附后),不做处理MVC框架包装异常后,前台显示"Could not execute JDBC batch update; nested exception is org.hibernate.exception...",报错信息不友好,故主动捕获后跑出友好业务相关信息"XXXXXXXXXX重复"。 2.框架:Hibernate+Spring+公司MVC。 3.异常详情: Could not execute JDBC batch update; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update 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