| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| hey everybody, I am trying to write a query like this: SELECT * from person WHERE personId IN ( ?1 ) the query should take just one parameter, List of personIds : util.List<Integer> so it becomes: query.setParameter(idList); how i can do this? or is it possible with openJpa? -- View this message in context: http://n2.nabble.com/query-setParame...76p840676.html Sent from the OpenJPA Users mailing list archive at Nabble.com. |
|
#2
| |||
| |||
| Hi there. OpenJPA does indeed support queries that use a list parameter as query criteria. Here's a snippet of code that uses a JPQL query to return those Person entities which have a matching id in a list of personId. Query qry = em.createQuery("SELECT p FROM Person p WHERE p.personId IN ( ids )");List<Integer> ids = new ArrayList<Integer>(); ids.add(1); ids.add(2); qry.setParameter("pids", pids); List<Person> people = qry.getResultList(); -Jeremy |
|
#3
| |||
| |||
| thanks a lot, now it works. I was using native query not hql query. that's why it didn't work. -- View this message in context: http://n2.nabble.com/query-setParame...6p1057825.html Sent from the OpenJPA Users mailing list archive at Nabble.com. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.