使用
Session session = sessionFactory.getCurrentSession();
session.update(user);
时候报错
org.springframework.dao.DataIntegrityViolationException: not-null property references a null or transient value: com.winheng.model.User.name; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: com.winheng.model.User.name
user 是个实体对象
网上查资料说表的字段设置不能为空,而我更新的时候没有在user实体对象中给这个字段设值
我现在就想问,怎么让他更新的时候,不更新我user中为NULL的值~~~求大神指教啊
追问:
在实体类中我设置了@DynamicUpdate(true)还是不行