12 Replies Latest reply on Feb 17, 2011 4:07 AM by Martin Frey

    EntityQuery with restrictions problem

    asaf sh Expert

      Sometimes restrictions cannot be based on EL expressions,

      I have a class that inherits EntityQuery for an entity that has a property named 'End'

      I would like to add a restriction that corresponds to a selectbox in JSF that has three string options ALL,FINISHED AND ACTIVE where:
      ALL - any entry without restrictions
      FINISHED - where End is not null
      ACTIVE - where End is null.

      so the restriction can look like

      myEntity.end is not null

      The problem is that I have to generate the value of the restriction based on the selected option,

      setRestrictionExpressionStrings expects only expressions, not static strings.

      I would like to check the returned value and add a static (string) restriction without any expression,

      I tried to override getResultList and add it to the restrictions but it resulted many new exceptions

      I couldn't find the right place to do that, is there any?