Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

IN clause in query for integers  RSS feed

 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a list of integers. This list holds values for an integer column in a table. I want to create a hibernate query that will get all the records for the values in this list.

For example I have a list of emp_nos, I want to do something like this in hibernate...

select * from emp where emp_no in (15,42,22)

Here 15,42,22 and the list of ints in my collection.

So my list is a java collection of integers and I need to plug this list into the IN clause of a hibernate query.

Any suggestions on how I can do this.

Thanks in advance for any help,
Jehan

[ May 09, 2008: Message edited by: Jehan Jaleel ]

[ May 12, 2008: Message edited by: Jehan Jaleel ]
[ May 12, 2008: Message edited by: Jehan Jaleel ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!