2 Replies Latest reply on Jun 28, 2007 3:17 AM by Malte Wiskott


    Malte Wiskott Newbie

      Hi there,

      Is there a way to "or" the RESTRICTIONS in an EntityQuery ?

      Not working example:

      RESTRICTIONS = {"(model.playerByBrandid = #{selectedPlayerFilter} or model.playerByManufid = #{selectedPlayerFilter})",} ;

      Thanks in advance,


        • 1. Re: or in RESTRICTIONS
          Dan Allen Master

          This is indeed possible, just not in the obvious way. Let me present you with an example.

           ejbql="select from Contact">
           <value>(lastName = #{nameFilter} or firstName = :el1)</value>

          Seam generates named parameters in the pattern "el" + 1-based index of the restriction. So you can repeat the value expression by using this name. I am not 100% sure that it starts at 1, because the code seems to leave room for earlier positional parameters, but in all my tests, it always starts with :el1. Of course, you continue on in the same manner. If you had another restriction, you would use :e2 in that value.

          • 2. Re: or in RESTRICTIONS
            Malte Wiskott Newbie

            Thank you Dan,

            Your solution works like a charm and thank you to Seam that it indexes
            even the not used restrictions.