这是我面临的问题。
我有一个非空字段 CREATE_DATE 的表。在此表中完成任何更新时,我不想更新此特定列。所以我给了
dynamic-insert="true" dynamic-update="true"
在表 hbm.xml 中。所以问题是我遇到了错误,例如尝试将 null 更新为非 null 字段,即使我没有修改该对象。我在这里粘贴代码。
if (userDO.getUserId() != null) {
if(SessionManager.getInstance().currentSession() != null){
getSession().evict(userDO);
getSession().clear();
}
getSession().update(userDO);
//getSession().saveOrUpdate(userDO);
}