1 Reply Latest reply on Jul 12, 2010 10:49 PM by Herberson Silva

    EntityQuery and columns mapped as Boolean

    Nigel Kerr Newbie

      Good Folk,


      I have a table with several yes_no columns: the type is char(1), the values are Y and N, some of them are nullable, others are not.


      2.2.1.CR1 seam-gen generates an EntityQuery for this table that does not mention these columns for restrictions: there isn't a restriction for them in RESTRICTIONS, the .page.xml does not have a param for them.  So: one cannot out of the box filter on these columns with the generated EntityQuery.  You can sort, as demonstrated by the ...List.xhtml out of the box, and that works like a charm: order-by clauses are easy.


      And after having struggled some, I think I can see why: an additional flag of some sort is needed to determine don't-filter-on-this-boolean, the value of the member on EntityQuery's private instance of the Entity class is not enough.  This extra field needs to be used at the time restrictions would normally be applied to cause the correct restriction to come into existence:


         my flag is null or not-converted?  -> omit the restriction for this column


         my flag is specified and yes/true?  -> make a restriction on this column for 'y'


         my flag is specified and no/false?  -> make a restriction on this column for 'n'


      Has anyone addressed this issue elsewise, that is, making use of the EntityQuery with Boolean (nullable or no) mapped columns?


      Went through something like this voyage of discovery for columns mapped as enum types already, but that was fairly straight-forward for filtering.


      Appreciate any thoughts here.


      cheers,
      Nigel Kerr