在Collection中,在JPARepository查询中对我不起作用

时间:2015-07-16 03:28:21

标签: sql spring jpa spring-data spring-data-jpa

In Collection在JPARepository查询中对我不起作用

我正在使用Spring JPA和基于primefaces的环境。我在JPARepository中创建了一个查询,如下所示:

如果我传递匹配数据库中某个帐号的单个Account对象,它就可以工作。一旦我添加另一个对象,查询就会开始返回0

    Account account = new Account();
    account.setNumber("700718");
    account.setName("ENERGYAUSTRALIA NARRABRI GAS");
    accounts.add(account);

   // Un-commenting this returns 0 results
   //       Account account2 = new Account();
   //       account2.setNumber("7009");
   //       account2.setName("KRAFT FOODS LIMITED");
   //       accounts.add(account2);


    ServiceLine serviceLine = new ServiceLine();
    serviceLine.setId("AD&I");

    List<Opportunity> opps = dao.findByServiceLineAndAccountInAndOwnerContainingAndStatus(serviceLine, accounts, "Andr", "Won");

当评论account2时,我得到一个结果。需要一些帮助

级联调用如下所示: 在DAO

  getRepository().findByServiceLineAndAccountInAndOwnerContainingAndStatus(pServiceLine, pAccounts, "%" + pOwner + "%", pStatus);

在REPOSITORY中呼叫

  List<Opportunity> findByServiceLineAndAccountInAndOwnerContainingAndStatus(ServiceLine pServiceLine, List<Account> pAccounts, String pOwner, String pStatus);

0 个答案:

没有答案
相关问题