File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Hibernate query help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate query help" Watch "Hibernate query help" New topic

Hibernate query help

Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
I have this query:

select user.userID.userId from User2Element user where user.elementID.elementId in (1, 4, 19, 25, 36)

I am searching by a list of elements IDs
How can I convert this query to dynamic query by passing a list of elements IDs?

I got this error : "unexpected token"

Any help is appreciated,

SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
Walter Bernstein
Ranch Hand

Joined: Dec 19, 2007
Posts: 57
Use "setParameterList()":
I agree. Here's the link:
subject: Hibernate query help
Similar Threads
Stored Procedure inside HQL query?
Convert SQL to HQL
Hibernate Query Language where clause
list in HQL
How to use IN clause in HQL?