You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by is_maximum <mn...@gmail.com> on 2008/12/28 08:55:48 UTC

OpenJPA dosn't respect numeric parameters order - bug?

Hello

consider a query with two parameter ?1 and ?2
if the order they are apeared in query is ?2 and ?1 then OpenJPA can't
understand the real order!!!

String query = "select e from MyEntity as e where e.name = ?2 and e.amount <
?1";

Query q = em.createQuery(query);
q.setParameter(1,new Double(1000));
q.setParameter(2,"John");

q.getResultList();

after this line openJPA complains that the parameter 2 is of type
java.lang.String but is declared in query for the type java.lang.Double

this is an incorrect actions since many queries we are building are creating
at runtime and we can only rely on this order but now OpenJPA messed up
everything!

Do I have to post an issue in JIRA?





-- 
View this message in context: http://n2.nabble.com/OpenJPA-dosn%27t-respect-numeric-parameters-order---bug--tp2017823p2017823.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.


Re: OpenJPA dosn't respect numeric parameters order - bug?

Posted by is_maximum <mn...@gmail.com>.
Hi
we are using OpenJPA 1.2.0 and Oracle 9i
You mean I try nightly builds?


Pinaki Poddar wrote:
> 
> Hi,
>   What is the OpenJPA version being used?
>   The cited example works  on trunk. 
> 
> 
> is_maximum wrote:
>> 
>> Hello
>> 
>> consider a query with two parameter ?1 and ?2
>> if the order they are apeared in query is ?2 and ?1 then OpenJPA can't
>> understand the real order!!!
>> 
>> String query = "select e from MyEntity as e where e.name = ?2 and
>> e.amount < ?1";
>> 
>> Query q = em.createQuery(query);
>> q.setParameter(1,new Double(1000));
>> q.setParameter(2,"John");
>> 
>> q.getResultList();
>> 
>> after this line openJPA complains that the parameter 2 is of type
>> java.lang.String but is declared in query for the type java.lang.Double
>> 
>> this is an incorrect actions since many queries we are building are
>> creating at runtime and we can only rely on this order but now OpenJPA
>> messed up everything!
>> 
>> Do I have to post an issue in JIRA?
>> 
>> 
>> 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/OpenJPA-dosn%27t-respect-numeric-parameters-order---bug--tp2017823p2073357.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.


Re: OpenJPA dosn't respect numeric parameters order - bug?

Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
  What is the OpenJPA version being used?
  The cited example works  on trunk. 


is_maximum wrote:
> 
> Hello
> 
> consider a query with two parameter ?1 and ?2
> if the order they are apeared in query is ?2 and ?1 then OpenJPA can't
> understand the real order!!!
> 
> String query = "select e from MyEntity as e where e.name = ?2 and e.amount
> < ?1";
> 
> Query q = em.createQuery(query);
> q.setParameter(1,new Double(1000));
> q.setParameter(2,"John");
> 
> q.getResultList();
> 
> after this line openJPA complains that the parameter 2 is of type
> java.lang.String but is declared in query for the type java.lang.Double
> 
> this is an incorrect actions since many queries we are building are
> creating at runtime and we can only rely on this order but now OpenJPA
> messed up everything!
> 
> Do I have to post an issue in JIRA?
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/OpenJPA-dosn%27t-respect-numeric-parameters-order---bug--tp2017823p2019260.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.