JPA: IN parameter to take in a Collection
584652May 12 2009 — edited May 18 2009Hi,
I am wondering whether in latest Toplink Essentials this issue (reproduced below for convenience) https://glassfish.dev.java.net/issues/show_bug.cgi?id=2484 has been fixed:
"For instance, the query "SELECT i FROM Person i WHERE i.address IN
(:collection)"
using setParameter("collection",list)
where list contains multiple strings Results in
"IllegalArgumentException: You have attempted to set a value of type class
java.util.ArrayList for parameter collection with expected type of class
java.lang.String from query"
Even though the spec states that the input parameter must "be like the same
abstract schema type of the state_field_path_expression in type"
TopLink Essentials could be extended to accept a collection containing valid
types. "
Another related discussion: http://forums.sun.com/thread.jspa?threadID=5251067
It does not really matter whether this issue has been fixed or not since I can build my query dynamically. I just need to know whether the fix is already available so that I can justify my solution of expanding the IN parameters manually if someone asked me.
Thank you.