You definitely can profit yourself from learning of Java basics.
Just look how Java handles varargs - this handling is not Spring-specific by any means.

Java language specification, 3rd edition, chapter 8.4.2 states:
Code:
If the last formal parameter is a variable arity parameter of type T, it is considered
to define a formal parameter of type T[].
So what you have observed is behavior dictated by language specification -no more, no less.

Regards,
Oleksandr
Quote Originally Posted by pgathua View Post
So I ran into this issue. I looked at the API. pass in a single Object parameter, it works. Pass in an Array of a single parameter it works too. Can't be both as both are definitely NOT the same thing. So which is it? API implies and explicitly says variable arguments meaning 1,2,3.... not int[]{1,2,3} or even int[]{1,2,3,4}.

Inquisitive about this, I did a quick experiment. I added another bind parameter to my query and now passed in the API mandated 1,2 Result? No fortune cookie for me! Now I pass in int[]{1,2} and Voilla!

So you see, the array is the right one. The variable argument list is just a side effect of the way they translate your parameters behind the scenes. Whatever it is they are doing, I can check or speculate but doesn't matter only works for the first parameter. Point is the API is wrong and documentation \ javadoc should be updated. In my case, my initial problem was complicated by the fact that I was dealing with Oracle dates and that's a PITA all in itself. After getting completely puzzled why it wont work, I fired up sql plus and wrote and ran equivalent query just for a sanity check. It worked fine. Hey who needs Spring when we have sql plus? So cut it down to a sigle parameter and it worked. I added another one with the array and was even more confused why it worked. Then I realized what was going on. Searched online found this thread.

Hope that helps others who get confused by this.