• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

JPQL WHERE IN Help

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello to all -

I'm working with JPA for the first time, and have come across a problem I can't seem to find a solution for, executing a WHERE IN native query.

Entity Class:


From EntityManagerController:


The RegistrantsFilter isn't being used currently, I can't even run a test case. The Exception thrown isn't much help, just an EJB exception subsequently being thrown by an AbortProcessException.

I'm using EclipseLink JPA 2.0 to a MySQL 5.x database w/ Glassfish 3.1. My persistence.xml works with 4 other entity classes with basic CRUD operations, but this WHERE IN is starting to be the death of me. I've tried different data structures, removing the () around :branches, tried making the List generic with integers, everything.

Any help would be greatly appreciated.
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you mean "named" query or "native" query?

You annotation is a named JPQL query, not an native SQL query.

This should work for JPQL, but remove the brackets. Also ensure you are using at least the EclipseLink 2.1 release.
For a native SQL query you cannot bind a collection, as it is not a valid SQL type.

What error are you getting? If you have something else masking the error, put a try catch around the query getResutList and dump the exception, or enable logging.
reply
    Bookmark Topic Watch Topic
  • New Topic