1 Reply Latest reply on Jul 1, 2009 7:03 PM by Dan Keyes

    EntityQuery

    Dan Keyes Newbie

      I'm starting a project based on the source code that was generated by Seam-Gen.  I've noticed that the CRUD pages that search the reverse engineered database tables only use Strings as search parameters.  I assume that's because the EntityQuery base class does a great job when the filter parameters are Strings.  I would like to also use numeric search parameters.  I know that I can easily add numeric restrictions to the String array named RESTRICTION.  That works fine except in the case where I would like to allow the user to leave some of the numeric values blank. In other words, I would like to leave any given numeric search parameter out of the search if the user didn't assign a value to the parameter.  I suppose I'll have to read those numeric values as Strings so that it's possible to distinguish between the numeric parameters that have been left blank and those that have a value that was entered by the user.  Once I have that String parameter that represents a numeric value, how can I use it in the search?  What I would really like to do is setup that RESTRICTION array such that the numeric value is included in the search only when it has been set by the user.  Is it possible to do that sort of thing using the RESTRICTION array inside a class that extends EntityQuery?  Would it be better to just not extend the EntityQuery base class in that case?


           

        • 1. Re: EntityQuery
          Dan Keyes Newbie

          One option for solving this problem is to change the contents of the RESTRICTIONS array depending on which search parameters the user has provided.  For example, if the user specifies a value for a numeric search parameter, then I could add a new restriction to the RESTRICTIONS array and then invoke the setRestrictionExpressionStrings method with RESTRICTIONS as the argument.  Unfortunately, Dan Allen once mentioned that the setRestrictionExpressionStrings method should only be invoked in the constructor of the subclass of EntityQuery where the RESTRICTIONS array is defined.  Can anyone suggest an alternative solution?  Is the best solution to just not extend the EntityQuery class if I need to do something like this?