0

I have an array of ids, long[] ids, and I want to retrieve a List of entities that have the ids from the id array using CriteriaQuery.

I tried to achieve this with the following code:

for (int i = 0; i < orderIds.length; i++) { 
    criteriaQuery.select(root); 
    criteriaQuery.where(criteriaBuilder.equal(path,orderIds[i]));
    List<E>certificates=super.entityManager.createQuery(criteriaQuery).getResultList();
    map.put(orderIds[i], certificates); 
}

This code returns a Map, but I want to retrieve a list of all the entities E that have the ids among the orderIds list. How can I do it?

Thank you!

default locale
  • 13,035
  • 13
  • 56
  • 62
  • Please provide more details – Kannan Thangadurai Sep 29 '14 at 12:46
  • for (int i = 0; i < orderIds.length; i++) { criteriaQuery.select(root); criteriaQuery.where(criteriaBuilder.equal(path,orderIds[i])); Listcertificates=super.entityManager.createQuery(criteriaQuery) .getResultList(); map.put(orderIds[i], certificates); This code returns a Map and i want to retrieve a list of all the entities E that have the ids among the orderIds list. – Ciprian Constantin Hurmuzache Sep 29 '14 at 13:00

0 Answers0