1

I want to pass multiple values in where clause,for that i am passing the array but the result returning empty.

  List<String> stringlist=new ArrayList<String>();
    stringlist.add("54aca811edc5a179efd28e55");
    stringlist.add("54aca79aedc5158d25a93f42");
    Query q = em
            .createQuery("Select s from StoreProductMaster s where s.store_id = :ids");
    q.setParameter("ids",stringlist);
    List<StoreProductMaster> tweets = q.getResultList();

Help me

  • You have a couple of unanswered or unaccepted questions on what amounts to the same topic. Kundera is something trying to be "all things to all people" and hence allow both SQL RDBMS and NoSQL solutions as a storage engine. But SQL concepts don't map well to NoSQL except in trivial examples. What you are asking for here and elsewhere would seem to require "native query" support. Unless of course the MongoDB adapter here is smart enough to process a statement using `IN` mapping to the same `$in` for MongoDB. At any rate, these are probably `ObjectId` values and not strings. – Neil Lunn Jan 07 '15 at 04:51
  • Well i think your point is just a small aspect on looking at Kundera. Kundera being a "one stop solution" doesn't stop you from using Mongo DB or Cassandra specific features. You can always execute those. – vivek mishra Jan 09 '15 at 12:47

1 Answers1

0

@Sreekant

As you need to fetch results for multiple ids from a collection , don't you think that your query should contain "in" clause instead of "=" ?

Query q = em .createQuery("Select s from StoreProductMaster s where s.store_id in :ids"); q.setParameter("ids",stringlist); List tweets = q.getResultList();

Chhavi

Chhavi Gangwal
  • 1,166
  • 9
  • 13