我需要执行以下选择:
select c.address from Customer c where lower(trim(c.name)) = :name
但我得到以下例外:
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
知道如何将trim
与lower
结合使用?
答案 0 :(得分:10)
我发现了解决方案,您必须使用both
才能使语句正常工作:
select c.address from Customer c where lower(trim(both from c.name)) = :name