Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

List use in JPQL syntaxis

MrBabakishiyevJul 26 2011 — edited Jul 27 2011
Hello.
Can I use List<CardIds> in JPQL syntaxsis? I can, please write.
Thanks

public int getCardsByIdsSorted(//List<String> cardIds,
String field, boolean ascending) {
int a = 0;
List<Card> cardList; //= new ArrayList<Card>();
List<String> cardIds = new ArrayList<String>();
cardIds.add("66b72972-ea0e-4b24-a692-f220da739298");
cardIds.add("35676406-0fd4-4fd2-9ca7-22c628978983");
cardIds.add("520602e3-bd47-486c-8824-b2ac7d4957ab");
try {
cardList = entityManager.createQuery("SELECT u FROM Card u WHERE u.id IN (:cardIds)").setParameter("cardIds", cardIds).getResultList();
a = cardList.size();
} catch (Exception ex) {
System.out.println(ex.getMessage());
}

return a;
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 24 2011
Added on Jul 26 2011
1 comment
125 views