我有一個更新查詢像這樣JPA批量更新語句
Update Table name set valstring = ? where valstring = ? and ID in (?)
所以JPA交易
em.CreateNativeQuery(Update_QUERY).setParameter(1, updatedStatus).setParameter(2,currentStatus).setParameter(3,ids).executeUpdate();
的輸入法列表ID,currentStatus和updatedStatus
如何將列表作爲單個參數傳遞,如果將List轉換爲逗號分隔的字符串我得到錯誤指定的文本不是數字,因爲In子句中不允許使用字符串
爲什麼要使用「本地查詢」時JPQL不更新也 –
我是新來JPQL所以不能找到一種方法,我可以通過ID列表中,如果您有任何建議,請讓我知道 – avenirit12
爲已經說過...使用JPQL更新,並支持輸入列表作爲參數值 –