我最近在我的用戶和user_audit表中添加了一個新列「PASSWORD_RESET_REQUIRED」。Hibernate canot在刪除時將空值插入到審計列
不是當我試圖刪除用戶 我得到一個錯誤說:
不能將NULL插入( 「USER_AUD」 「PASSWORD_RESET_REQUIRED」。)
@Entity
@Table(name = "sec_user", schema = "RZUL_DATA")
//Override the default Hibernate delete and set the termination date rather than deleting the record from the db.
@SQLDelete(sql = "UPDATE RZUL_DATA.sec_user SET trmn_dt = sysdate WHERE user_id = ?")
@Audited
public class User {
@NotEmpty
@Column(name = "password_reset_required", updatable = true, insertable = true)
private String isPasswordResetRequired;
... other properties
}
我userDAO的刪除方法:
@Override
public boolean deleteUser(final User user) {
sessionFactory.getCurrentSession().delete(user);
NOTE: Till this point I can see the user.isPasswordResetRequired an a non null.
return true;
}
我可能錯過了哪些部分?