RE: [question] ExpressionFactory.notInExp()

From: Cris Daniluk (cris.danilu..laraview.com)
Date: Wed Feb 16 2005 - 16:35:37 EST

  • Next message: Mike Kienenberger: "Re: Hello & Question..."

    First of all, how can you expect Cayenne to help you if you're trying to
    query against data that doesn't exist in the object model? That's just bound
    to fail :)

    You're not going to be able to do this in a single query without extending
    Cayenne just a touch (ExpressionFactory.noMatchingRelationship() for
    example). Such an extension would not work on all databases though, so it
    likely wouldn't make it into cayenne if you did it...

    With this data model, you're better off executing the subselect as a Cayenne
    SelectQuery (which means its gotta be in the object model) and then using
    notInExp on the resultant List. This will perform fine unless you're looking
    at tons of data.

    Really though, I'd try to avoid this situation altogether. Subselects are
    useful for ad hoc queries, etc, but as something that is part of your
    standard business logic, it seems indicitive of a relational data structure
    that does not meet your needs.

    Cris

    > -----Original Message-----
    > From: Laszlo Spoor [mailto:lspoor_cayenn..otmail.com]
    > Sent: Wednesday, February 16, 2005 4:10 PM
    > To: cayenne-use..bjectstyle.org
    > Subject: Re: [question] ExpressionFactory.notInExp()
    >
    > Hi Mike,
    >
    > Thank you for responding! Your first solution will not work.
    > The notInExp() takes a String and an Object. The id I
    > mentioned in the SQL is not included in my objectmodel, so,
    > if I try something like "ExpressionFactory.noInExp("id",
    > myObjectList), this cannot be resolved.
    >
    > Yes, I could, as a last act of despairation evade to the SQL
    > Template, but I don't think this is a very good solution for
    > an ObjectRelational Bridge, so I am still trying to resolve
    > this problem 'Cayenne Style'. :)
    >
    > Can you tell me how I can refer to the 'current Object' when
    > I try to link to the notInExpression. So, normally you would
    > do something like:
    >
    > ExpressionFactory.notInExpression("toPaintings",
    > myUnSelectedPaintsCollection);
    >
    > but since I am already in the paintings collection, I cannot
    > use "toPaintings", but I need something like "this" or
    > "current"... Is there something like that?
    >
    > Regards, laszlo
    >



    This archive was generated by hypermail 2.0.0 : Wed Feb 16 2005 - 16:35:36 EST