• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

usage of "in" clause

 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an hibernate query which uses the "IN" clause

WHERE LDRCHNL.lenderId = ? and LDRCHNL.channelId in ( ? )

here channelId is defined as long, if i hard code the values in the above query like

WHERE LDRCHNL.lenderId = ? and LDRCHNL.channelId in (1,2) it works good, but i want to pass the values inside IN dynamically. Could someone help me with this ?

Thanks,
Rajeev
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use bind variables. So instead of ? use :idList.

Then you can set parameter list to an array of IDs.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic