2012-04-11 34 views
1

我最近在我的用户和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; 
} 

我可能错过了哪些部分?

回答

0

确保您*_HISTORY表没有NOT NULL数据Colums。