String methodName = getClass().getName()+ "." + method;
return em.createQuery(QueryLanguages.LANG_METHODQL, methodName);
}
public void testMethodQLWithParameters() {
OpenJPAQuery q = createMethodQuery("echo");
Query kernelQ = q.unwrap(Query.class);
kernelQ.declareParameters("String firstName, String lastName");
q.setParameter("firstName", "Fred").setParameter("lastName", "Lucas");
Object result = q.getResultList().get(0);
assertTrue(result instanceof Map);
Map params = (Map)result;
assertEquals("Fred", params.get("firstName"));
assertEquals("Lucas", params.get("lastName"));
}