org.hibernate.QueryException: could not resolve property:

▼魔方 西西 提交于 2019-12-13 22:50:25

问题


I have been trying to solve this one since morning. But i am unable to.

Query query = em.createQuery("Update ABC p set p.sync_status=14 where p.eventhistoryid in (select c.eventhistoryid from  ABC c where c.sync_status=0 and c.receivedtimestamp >=  getTimeStampAfterDeductingHours(24)");

ABC entity class contains the below column:  
@Column(name="sync_status")
private short syncStatus = 0;

this column is SMALLINT TYPE and NOT NULL.

Getting the below error:

org.hibernate.QueryException: could not resolve property: sync_status .


回答1:


In HQL/JPQL, you don't make reference to database column names, you reference property names instead.

Use syncStatus in the query, not sync_status.



来源:https://stackoverflow.com/questions/21480018/org-hibernate-queryexception-could-not-resolve-property

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!