you may want to check in your server.log (which is quite helpful to me, to
understand finding and optimized loading-issues) that the resulting
prepared-statement is indeed not what you wanted.
the resulting statement will be ... where ID IN (?), which can't work, since
you'd like to have where ID IN(?,?,?) and every parameter filled in. else your
db will believe its just one parameter of the ID#type.
a quick and dirty workaround: concatenate the string with some delimiter before
passing it to the finder, and write a little database function that explodes
your delimiter-seperated list.
best would of cause be to set up cmr properly - but this seems like hard work
for a whole application.
oracle-compatible where clause+impl:
public xxx findByResourceList (String[] asResourceIDList) {
| StringBuffer res = new StringBuffer();
| res.append(',');
| for(String s: asResourceIDList)
| res.append(s).append(',');
| return findByResourceListDummy(res.toString());
| }
|
<query>
| <query-method>
| <method-name>
| findByResourceListDummy
| </method-name>
| <method-params>
| <method-param>java.lang.String</method-param>
| </method-params>
| </query-method>
|
| <declared-sql>
| <where>instr({0}, ',' || id || ',')>0</where>
| </declared-sql>
| </query>
|
though i'm not sure if you can do that function stuff here, it should be
possible somewhere;)
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025841#4025841
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025841
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user