【发布时间】:2012-03-15 12:47:15
【问题描述】:
我已经使用休眠在数据库中创建了一个表,其中一个属性(用户名)是主键。所以当我尝试在用户名中插入重复值时,我得到以下异常。现在我必须处理这个异常以提示用户“用户名已存在”。
22462 [http-8080-2] 警告 org.hibernate.util.JDBCExceptionReporter - SQL 错误:0,SQLState:null 22462 [http-8080-2] 错误 org.hibernate.util.JDBCExceptionReporter - 批处理失败 22462 [http-8080-2] 错误 org.hibernate.event.def.AbstractFlushingEventListener - 无法将数据库状态与会话同步
【问题讨论】:
标签: hibernate exception-handling primary-key