【问题标题】:Jpa nested query for concat with like带有like的连接的Jpa嵌套查询
【发布时间】:2014-10-07 23:18:52
【问题描述】:

以下代码在第 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);

【问题讨论】:

  • 这在 oracle DB 中很好。 select * from (select CONCAT(organizationName,emailId)as txt from Organization o ) p where p.txt like '%C%';

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


【解决方案1】:
entityManager.createQuery("select o from Organization o where" +
                " o.organizationName like:sSearch or" +
                " o.emailId like:sSearch",Organization.class);

【讨论】:

    猜你喜欢
    • 2017-02-12
    • 1970-01-01
    • 1970-01-01
    • 2022-12-02
    • 2017-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-11
    相关资源
    最近更新 更多