[英]Error in hibernate named query
@NamedQuery(name="getHeightByTaskId",query="select otherheight from BTSTaskDetail where id=2 for update")
錯誤
ERROR internal.SessionFactoryImpl - HHH000177:命名查詢錯誤:getHeightByTaskId org.hibernate.hql.internal.ast.QuerySyntaxException:意外標記:對於第 1 行,第 79 列 [從 com.inn.siteforge2.bts.model.BTSTaskDetail 中選擇其他高度其中 id=2 用於更新]
for update
是無效的 JPQL 關鍵字
對於鎖定使用標准方法之一: https : //en.wikibooks.org/wiki/Java_Persistence/Locking
@NamedQuery(name = "BTSTaskDetail.otherheight", query = "SELECT c FROM BTSTaskDetail c WHERE c.otherheight = :otherheight"),
現在更新您的實體並保存它們。
關於什么
@NamedQuery(name="getHeightByTaskId",query="select otherheight from BTSTaskDetail where id=2",lockMode = PESSIMISTIC_WRITE)
?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.