Re: R: Unable to build the right expression

From: Tore Halset (halse..vv.ntnu.no)
Date: Wed Aug 25 2004 - 03:39:23 EDT

  • Next message: Twan Kogels: "Re: SQLTemplate with addPrefetch?"

    On Aug 25, 2004, at 9:32, Claudio Rosati wrote:

    > OK, but how can I query for nodes without leaves? The following
    > expression
    > will work
    > exp = exp.andExp(ExpressionFactory.matchExp("variantForms", null)) (I
    > think no, because being "variantForms" a List mapping a to-many
    > relation, ti
    > will be always non-null but, eventually, empty).

    I guess I do not fully understand your problem. My solution was to
    create two separate queries:

    1: query for nodes containing stext.
    ExpressionFactory.likeIgnoreCaseExp("name", "%" + stext + "%");
    + node XXX 123
         + leaf ABC 345
         + leaf DFG 456
    + node XXX 345
     
    2: query for nodes that has a leaf that contains stext.
    ExpressionFactory.likeIgnoreCaseExp("variantForms.name", "%" + stext +
    "%")
    + node AFG 954
         + leaf DFG 456
         + leaf XXX 336

    Of cource some nodes might qualify for both query 1 and 2, but that
    should be easy to filter out in your application.

      - Tore. 



    This archive was generated by hypermail 2.0.0 : Wed Aug 25 2004 - 03:39:36 EDT