[
https://issues.apache.org/jira/browse/OPENJPA-955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12679237#action_12679237
]
Marc Logemann commented on OPENJPA-955:
---------------------------------------
The problem is somewhere in MethodStoreQuery.bindParameterTypes():
private LinkedMap bindParameterTypes() {
ctx.lock();
try {
if (_params != null)
return _params;
String params = ctx.getParameterDeclaration();
if (params == null)
return EMPTY_PARAMS;
List decs = Filters.parseDeclaration(params, ',', "parameters");
if (_params == null)
_params = new LinkedMap((int) (decs.size() / 2 * 1.33 + 1));
String name;
Class cls;
for (int i = 0; i < decs.size(); i += 2) {
name = (String) decs.get(i);
cls = ctx.classForName(name, null);
if (cls == null)
throw new UserException(_loc.get("bad-param-type", name));
_params.put(decs.get(i + 1), cls);
}
return _params;
} finally {
ctx.unlock();
}
}
_params is null and even ctx.getParameterDeclaration(); doesnt return anything
useful. When passing the parameter into QueryImpl (the API one - not the
delegate) it wont be passed in the lower layers (the delegate). This is at
least what i ve learned from debugging so far.
> MethodQL parameter passing broken
> ---------------------------------
>
> Key: OPENJPA-955
> URL: https://issues.apache.org/jira/browse/OPENJPA-955
> Project: OpenJPA
> Issue Type: Bug
> Components: kernel
> Affects Versions: 1.2.0
> Reporter: Marc Logemann
>
> OpenJPAEntityManager oem = OpenJPAPersistence.cast(em);
> OpenJPAQuery query = oem.createQuery("openjpa.MethodQL",
> "de.logentis.openjpa.LogentisMethodQL.blabla");
> query.setResultClass(DP_PLZ_DA.class);
> query.setParameter(1, "Fred").setParameter(2, "Lucas");
> This results of an empty parameter Map in the LogentisMethodQL.blabla()
> method.
> Even worse, when doing parameter passing as stated in the docs Chapter 9 / 5:
> query.setParameter("first", "Fred").setParameter("last", "Lucas");
> There is an exception thrown.
> In fact MethodQL is completely broken when it comes to parameters at this
> point.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.