This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Useing IN clause in named/native query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Useing IN clause in named/native query" Watch "Useing IN clause in named/native query" New topic
Author

Useing IN clause in named/native query

pax smith
Ranch Hand

Joined: Dec 13, 2005
Posts: 45
I have created a query and have used 'IN' clause in it. But when I passed pamater "2,3" it is giving me error. Can anybody give any example in which he/she have used 'IN' clause.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32481
    
214

Pax,
You need to know the number of parameters in advance to use "?" binding variables. The alternative is to query objects one (or a fixed bunch) at a time or build the query at runtime.


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
pax smith
Ranch Hand

Joined: Dec 13, 2005
Posts: 45
I don't decide the no. of parameters in advance it is decided at runtime.

I don't want to append it in the query, is there any way to pass values it as parameter

Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32481
    
214

pax smith wrote:I don't want to append it in the query, is there any way to pass values it as parameter

No.
 
Have you checked out Aspose?
 
subject: Useing IN clause in named/native query
 
It's not a secret anymore!