org.hibernate.exception.ConstraintViolationException 约束违反异常

org.hibernate.exception.ConstraintViolationException约束违反异常
原因

必填字段没有传入值
违反唯一键,重复插入。(本身表中已经存在相同数据)

解决

将字段设置可以为空
设置默认值

测试环境报错异常

javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute batch。
SqlExceptionHelper Column ‘package_enable’ cannot be null

猜你喜欢

转载自blog.csdn.net/hello_world_1996/article/details/112599352