Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法使用hibernate执行HQL更新查询_Java_Mysql_Spring_Hibernate_Orm - Fatal编程技术网

Java 无法使用hibernate执行HQL更新查询

Java 无法使用hibernate执行HQL更新查询,java,mysql,spring,hibernate,orm,Java,Mysql,Spring,Hibernate,Orm,我有两个实体类BatchFile和BatchFileRecord。运行HQL查询时,会出现以下错误: org.hibernate.QueryException:无法解析属性:IsValidated of:com.cc.myApp.dal.models.BatchFileRecord Session sess = sessionFactory.getCurrentSession(); sess.beginTransaction(); String sb="update BatchFile bf s

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

org.hibernate.QueryException:无法解析属性:IsValidated of: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它不工作,我怎样才能帮助自己运行它呢?或者有其他方法可以这样做吗?

验证第一个大写字符与JavaBean标准不匹配。
请更改属性名称或将getter更改为getIsvalidated()

这看起来像是HQL和纯SQL的混合。您能在问题中包括实体类吗?当您使用实体管理器时,必须使用实体类的属性名而不是DB表的列名。您能用getter和setter发布BatchFile bean类吗