org.hibernate.exception.ConstraintViolationException: could not insert: [com.crownsoft.qsm.Teacher]?
在控制台上可以看到:
Hibernate: insert into gd.user (login_pwd, role, id) values (?, ?, ?)
Hibernate: insert into teacher (name, techtitle, sex, tel, email, department, id) values (?, ?, ?, ?, ?, ?, ?)
我用sql语句直接在数据库中写也没问题,但就是报这个错误!
------解决方法--------------------------------------------------------
违反了约束, 映射文件里是不是有长度什么的约束?