2014-01-31 220 views
-2

自從早上我一直試圖解決這個問題。但我無法。org.hibernate.QueryException:無法解析屬性:

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: could not resolve property: sync_status .

回答

1

在HQL/JPQL,你不提及數據庫列名,您引用屬性名稱來代替。在查詢中使用syncStatus,而不是sync_status

相關問題