简体   繁体   中英

Unable to execute HQL update query using hibernate

I have 2 entity classes BatchFile and BatchFileRecord. While running the HQL query it gives the following error:

org.hibernate.QueryException: could not resolve property: 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);

It works well using mysql directly but it doesnt works using hibernate, How can i help myself runnimg this? or is there any alternative way to do so?

IsValidated with first characted in uppercase doesnt match the java bean standard. Please change the property name or change the getter to getIsvalidated()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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