您好我无法通过休眠更新数据库中的 msgFromUserFlag。更新此值时,我也没有收到任何错误。
这是我在 DAO 层的代码。在数据库中,我的字段是 TINYINT(1) 类型,而在持久性类中,它是布尔类型。
public void updateMsgFromUserFlag(CustomerOrder customerOrderEntity){
try {
//update(customerOrderEntity);
final StringBuffer queryString = new StringBuffer("update CustomerOrder custOrder set custOrder.msgFromUserFlag = :param1 where custOrder.goldOrderNumber = :param2");
final Query query = this.getEm().createQuery(queryString.toString());
query.setParameter("param1",customerOrderEntity.isMsgFromUserFlag());
query.setParameter("param2", customerOrderEntity.getGoldOrderNumber());
int modification=query.executeUpdate();
}
catch(PersistenceException ex) {
otLogger.debug("OrderDaoImpl.exception occurred "+ex);
throw new TechnicalException(Constants.ERROR_HIBERNATE_EXCEPTION, ex);
}
}