【问题标题】:org.hibernate.QueryException: could not resolve property:org.hibernate.QueryException:无法解析属性:
【发布时间】:2014-02-24 03:28:20
【问题描述】:

我从早上开始就一直在尝试解决这个问题。但我做不到。

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 且 NOT NULL。

得到以下错误:

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

【问题讨论】:

    标签: hibernate jpql


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2013-07-25
      • 1970-01-01
      • 1970-01-01
      • 2017-09-30
      • 1970-01-01
      • 1970-01-01
      • 2015-09-22
      • 1970-01-01
      相关资源
      最近更新 更多