繁体   English   中英

无法使用休眠模式执行HQL更新查询

[英]Unable to execute HQL update query using hibernate

我有2个实体类BatchFile和BatchFileRecord。 运行HQL查询时,会出现以下错误:

org.hibernate.QueryException:无法解析属性:IsValidated:com.cc.myApp.dal.models.BatchFileRecord

Session sess = sessionFactory.getCurrentSession();
sess.beginTransaction();
String sb="update BatchFile bf set bf.isCheck = 0 where bf.Id in(selectb.BatchFileId from BatchFileRecord b where b.BatchId = "+batchId+" and b.IsValidated = 0) and bf.BatchId = "+batchId;
    Query query = sess.createQuery(sb);
    int numUpdated = query.executeUpdate();
    System.out.println("Rows affected: " + numUpdated);

它可以直接使用mysql很好地工作,但是不能使用hibernate来工作,我该如何帮助自己运行呢? 还是有其他替代方法?

IsValidated的第一个大写字母与Java Bean标准不匹配。 请更改属性名称或将getter更改为getIsvalidated()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM