RE: [question] ExpressionFactory.notInExp()

From: Laszlo Spoor (lspoor_cayenn..otmail.com)
Date: Thu Feb 17 2005 - 10:36:12 EST

  • Next message: Mike Kienenberger: "Re: Duplicate entry"

    Hi Chris,

    >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 :)

    I know.. That was my point. The SQL Query was simplified and just there for
    reference. I am sorry I was not clear about that.

    >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...

    Okay, so no go.. Thanks :)

    >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.

    mmm.. If I can find the time I will try to see if you are right, but I am
    afraid you are wrong. What is 'tons' in your opinion? 1000s? Or 1.000.000s?
    I will settle for the last number. Using my experience on this application
    will also form some sort of recommendation of Cayenne to my company. They
    will ask similar questions and I do not want to tell them that it cannot be
    done, since I am really happy with Cayenne.

    >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.

    You are right! It is an ad hoc query! I want to filter out the objects that
    are not used in the application and offer them to the user, so he can start
    using them.

    Don't worry about my datamodel. It meets all current business needs just
    fine. I think it is very flexible and from a rdbms point of view very
    performant.

    So, I guess I can do three things:
    - use the sql template
    - regenerate an object model with ids in it.
    - remove the functionality from the application

    Thanks for sharing your thoughts, laszlo

    >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
    > >
    >

    _________________________________________________________________
    Talk with your online friends with MSN Messenger http://messenger.msn.nl/



    This archive was generated by hypermail 2.0.0 : Thu Feb 17 2005 - 10:37:05 EST