JPA 查询 LIKE 不起作用

JPA query LIKE does not work

这个查询有什么问题:SELECT i FROM Item i WHERE 1 = 1 AND UPPER(i.nome) LIKE %:nome% ORDER BY UPPER(i.nome)?我尝试在 LIKE '%:nome%' 中使用和不使用单引号,但它不起作用。

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)

here所述,在设置参数时需要用%包裹值,例如:

query = em.createQuery("SELECT i FROM Item i WHERE 1 = 1  AND UPPER(i.nome) LIKE :nome  ORDER BY UPPER(i.nome)");
query.setParameter("nome","%"+nome.toUpperCase()+"%");