1 Reply Latest reply on Sep 4, 2008 5:38 PM by Alex Savitsky

    EntityQuery: OR clause

    Miloslav Vlach Novice
      Hi,

      I need to use a restrictions in EntityQuery object. The simple restrictions works good, but when I need to use OR keywords all going down.

      Let's imagine:


      select s from Somethis where s.author.loginName = #{loggedUser.loginName} or s.solver.loginName = #{loggedUser.loginName};


      There is problem. When I try to create this by restriction I don't success. because restriction add automaticaly AND keyword. When I create only one restriction


      (s.assicitaion.attribute1 = 'B' od s.assicitaion2.attribute1 = 'B')


      then I get the Exception that only ONE expression could be in restriction.

      When i create the query manually and get this query as return value of function getEjbql, the result is not good :

      The list contains only that record with

      s.author.fullName = loginName AND s.solver.loginName

      When the s.solver == NULL, the record is not returned.

      Know somebody how to solve this problem ?

      Thanks Mila