When I try to pass my arraylist in the SQL IN statement, it is passed as memory location rather than strings.
SELECT Pid FROM details WHERE number IN (" + tempArrayList.toString().replaceAll("\\[(.*?)\\]", "$1") + ")" ;
But, as I stated in the problem description, it prints
SELECT part_id FROM parts_details WHERE part_number IN ([Ljava.lang.Object;@7bb11784, [Ljava.lang.Object;@1ae369b7)
I have tried some alternatives
- Created the array string using
StringUtils.Join(tempArrayList.iterator())
Arrays.toString(tempArrayList.get(0)).replaceAll("[\\[\\]]", "") + "','"