0 Replies Latest reply on Aug 13, 2009 5:51 PM by Tanya Ruttenberg

    Working with EJBQL RESTRICTIONs and EntityQuery

    Tanya Ruttenberg Expert

      I need to restrict my data select with a couple of criteria that don't seem to fit so well with RESTRICTIONS.  Ultimately I want to




      select where carrier like %ATT% and carrier like %VZB%




      I'm pretty well resigned now to the fact that I can't use RESTRICTIONS like this



      "lower(office.wanvendor) = lower(#{office.att})",
      "lower(office.wanvendor) = lower(#{office.vzb})",




      because it seems that you can't restrict the same field twice.


      I also want to do


      select where totalUsers between 0 and 50


      but again you can't do this




      office.totalUsers between #{office.lowerLimit} and #{office.upperLimit}"




      because you can have only one EL-expression in the restriction.


      However, most of my other restrictions fit the standard paradigm so I don't want to have to create ALL the EJBQL manually.  I want to take what exists after the point where you setEjbql and apply the restrictions and THEN make alterations for my test case.




      setEjbql(EJBQL);
      setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
      get the query that exists at this point and alter it accordingly




      Any way to do this?