如何在JPQL中结合TRIM和LOWER函数?

时间:2013-04-18 09:03:28

标签: jpql

我需要执行以下选择:

select c.address from Customer c where lower(trim(c.name)) = :name

但我得到以下例外:

javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query

知道如何将trimlower结合使用?

1 个答案:

答案 0 :(得分:10)

我发现了解决方案,您必须使用both才能使语句正常工作:

select c.address from Customer c where lower(trim(both from c.name)) = :name