3 Replies Latest reply on May 29, 2006 4:24 PM by Javier Pedrido

    Wrong query being generated

    Javier Pedrido Newbie

      Hi,

      I think I found another error in JBoss EJB3 implementation.

      If I execute the following query

      Query q = manager.createQuery("SELECT N FROM Customer N Where " +
       "(N.id = 1 AND N.name = 'Bill') "
       + " OR " +
       "(N.id = 2 AND N.name = 'Javier')");
      


      JBoss generates the following SQL command


      select
      customer0_.id as id11_,
      customer0_.name as name11_
      from
      Customer customer0_
      where
      customer0_.id=1
      and customer0_.name='Bill'
      or customer0_.id=2
      and customer0_.name='Javier'


      that's wrong (in my opinion). The parenthesis should not removed from the where clause.

      Thanks in advance,
      Javier