Jpa嵌套查询concat with like

时间:2014-08-14 10:25:23

标签: hibernate spring-mvc jpa jpql spring-data-jpa

以下代码在第15列给出了错误说明意外令牌的错误,我正在尝试连接两列,然后想要将该字符串与like运算符匹配:

entityManager.createQuery(
"select p from 
   (select o,CONCAT(organizationName,'|',emailId)as txt from Organization o ) p 
   where p.txt like:%o%", Organization.class);

1 个答案:

答案 0 :(得分:1)

entityManager.createQuery("select o from Organization o where" +
                " o.organizationName like:sSearch or" +
                " o.emailId like:sSearch",Organization.class);