Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA - using long array in IN operator throws cast exception.

 
Subash Karuppaiah
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, am new to JPA and am able to get it quickly, I had been trying a select query using "IN" operator in the query and had been getting the error as down. What I do is, i get a array of (long) message ids from a function and i use it to select the record based on those ids. Here is my query



I had just shown you part of the code, in entity messageId is long and in Oracle DB its number. When i try as just as long variable it works, it doesn't seem to work when i pass long array. Had any one come across such a problem can some one help out. This is the error

14:24:49,428 INFO [LongType] could not bind value '[J@14f76da' to parameter: 1; [J cannot be cast to java.lang.Long


Thanks!!
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



This is an collection of one item, to define a collection argument you need to use,



 
Subash Karuppaiah
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi James, i had resolved it, thz. I had to pass it as ArrayList.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic