3 Replies Latest reply on Aug 16, 2010 6:27 AM by Leo van den berg

    EntityQuery with "global" restrictions

    Alexander Sparkowsky Newbie


      I'm trying to implement something like the following statement using an extended EntityQuery object in Seam 2.2.0.GA

      FROM Project p WHERE (p.owner.id=#{currentUser.id} AND p.deleted is null) AND (restriction1 OR/AND restriction2 OR restriction3)

      restriction1 ... restriction3 are restrictions set by setRestrictionExpressionStrings() method while

      (p.owner.id=#{currentUser.id} AND p.deleted is null)

      is always added to the statement.

      The problem is that the EntityQuery is building the query like

      FROM Project p WHERE (p.owner.id=#{currentUser.id} AND p.deleted is null) AND/OR (restriction1 OR/AND restriction2 OR restriction3)

      This means that using OR as restriction logic operator will erase my global restriction

      (p.owner.id=#{currentUser.id} AND p.deleted is null)

      Is there some way I can use EntityQuery to fulfill this task or do I have to implement all by myself?