org.hibernate.exception.ConstraintViolationException


org.hibernate.exception.ConstraintViolationException
 

今天遇到这个错误,网上查了下,大多说是有必填字段没有填,搞了很久没搞定,最后发现不是因为这个问题,而是因为字段设置了唯一值,如果表中已存在此记录,再插入则报此错误。

Hibernate: insert into membership.t_user (login_id, password, type, status, email, mobile, first_name, last_name, nickname, gender, birthday, country, region, creation_date, last_update_date, join_confirm_date, activation_date, deactivation_date, register_code, join_expire_date) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
org.springframework.dao.DataIntegrityViolationException: could not insert: [com.igen6.sac.ms.bean.TUser]; SQL [insert into membership.t_user (login_id, password, type, status, email, mobile, first_name, last_name, nickname, gender, birthday, country, region, creation_date, last_update_date, join_confirm_date, activation_date, deactivation_date, register_code, join_expire_date) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not insert: [com.igen6.sac.ms.bean.TUser]


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM