我有2个实体类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,我怎么能帮助自己runnimg这个?或者有其他方法吗?
答案 0 :(得分:0)
IsValidated with first characted in uppercase与java bean标准不匹配。 请更改属性名称或将getter更改为getIsvalidated()