此查詢有什麼問題:SELECT i FROM Item i WHERE 1 = 1 AND UPPER(i.nome) LIKE %:nome% ORDER BY UPPER(i.nome)
?我在LIKE'%:nome%'中嘗試過使用單引號但沒有使用單引號,但它不起作用。JPA查詢LIKE不起作用
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing [SELECT i FROM Item i WHERE 1 = 1 AND UPPER(i.nome) LIKE %:nome% ORDER BY UPPER(i.nome)].
[56, 63] The identification variable '%:nome%' is not following the rules for a Java identifier.
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1605)
使用'喜歡:nome',和前面加上/追加百分號的參數值。由於在我的應用程序中進行搜索,因此需要在不同的職位上使用 –