Hi Michael,
The fix looks good.
Thanks,
tom
Michael Bouschen wrote:
>Hi Tom,
>
>attached you find a fix for glassfish issue 183:
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=183
>
>With the current code you need to call Query.setParameter in the same
>order as the named input parameters appear in the EJBQL text. Otherwise,
>the generated SQL uses the parameter values in the wrong order:
> Query query = em.createQuery(
> "SELECT o FROM Order o WHERE o.orderId BETWEEN :lower AND :upper");
> query.setParameter("upper", new Integer(2));
> query.setParameter("lower", new Integer(1));
>results in the following generated SQL:
> SELECT ID, ... FROM ORDER_TABLE WHERE (ID BETWEEN 2 AND 1)
>Please note, the correct BETWEEN clause would have the values swapped.
>
>I changed the parameter handling in class EJBQueryImpl and replaced the
>lists of parameter names and values by a map. The internal method
>processParameters now returns a list of parameter values that are in the
>expected order. Please have a look.
>
>Thanks!
>
>Regards Michael
>
>
--
Tom Ware
Principal Software Engineer
Oracle Canada Inc.
Direct: (613) 783-4598
Email: tom.ware_at_oracle.com