【发布时间】:2014-06-13 03:31:22
【问题描述】:
我想写一个这样的查询
@Query("select p from Product p where p.name = ?1 or p.desc like %?1%")
但它给了我例外
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: % near line 1,
我尝试将 % 替换为 '%' 或像这样连接查询字符串:"select ... like '%'" + "?1" + "'%'" 但没有成功,请帮助我
【问题讨论】:
-
您使用的是哪个版本的 Spring Data JPA?
标签: hibernate jpa hql spring-data