org.hibernate.QueryException:无法解析属性:

时间:2014-01-31 12:23:34

标签: hibernate jpql

我从早上起就试图解决这个问题。但我无法做到。

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;

此列为SMALLINT TYPE且非NULL。

获得以下错误:

  

org.hibernate.QueryException:无法解析属性:sync_status。

1 个答案:

答案 0 :(得分:2)

在HQL / JPQL中,您不引用数据库列名,而是引用属性名称。

在查询中使用syncStatus,而不是sync_status