0 Replies Latest reply on Oct 3, 2007 2:59 AM by Kestas ruks

    select returns incorrect results

    Kestas ruks Newbie

      Hi,
      Time to time I get wrong select results.
      Simple query:
      select f from EntityName where upper(f.columnName) like :paramOne

      if paramOne = "test1" query should return ONE object
      if paramOne = "test2" query should return TWO object

      if entity (EntityName) was not used for some time and
      if I first execute query with paramOne = "test1" jboss returns ONE object and thats is ok, but if I after that execute query with paramOne = "test2" jboss returns only ONE object, but it should return TWO objects.

      It happens not always it is difficult to know when it will happen next time.

      When it happens all next queries with different paramOne values returns one object ignoring different paramOne values (which normally should return more than one objects). And this continues till you leave entity for some time not used. Or if change query (for example add additional parameter) it returns correct result.



      Real queries from app (I execute additionally select with count(*)) :

      First queries
      select count(*) from RiksUser f WHERE upper(f.bo.riksUserName) like :riksUserName
      riksUserName = %TEST1%
      Returns 1 - thats ok

      select f from RiksUser f WHERE upper(f.bo.riksUserName) like :riksUserName
      riksUserName = %TEST1%
      Returns 1 object - thats ok


      Second queries
      select count(*) from RiksUser f WHERE upper(f.bo.riksUserName) like :riksUserName
      riksUserName = %TEST2%
      Returns 2 - thats ok

      select f from RiksUser f WHERE upper(f.bo.riksUserName) like :riksUserName
      riksUserName = %TEST2%
      Returns 1 object - thats ERROR


      All those queries I execute on jboss-4.2.0.GA (EJB3).