RE: SingleObjectQuery & ObjectID

From: Dave Merrin (dmerri..pasystems.co.uk)
Date: Mon Feb 27 2006 - 05:03:58 EST

  • Next message: Todd O'Bryan: "Re: Generics"

    Hi Andrus,

    thanks for that. I had seen that method but was hoping there would be a way
    to invalidate all objects without having a reference to them.

    This now means I don't need the SingleObjectQuery as I just invalidate all
    objects as soon as they've been retrieved from the database.

    It's a shame there isn't just a way to turn off caching. Alternatively it
    would be good in the mapping file to be able to specify that only certain
    objects should be cached. I can do this myself by having a lookup list of
    object classes I want cached; that way I will only invalidate certain
    objects. Would just be a cool feature if it was in Cayenne.

    Anyway, thanks for the help,

    Dave

    > -----Original Message-----
    > From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    > Sent: 25 February 2006 05:15
    > To: cayenne-use..bjectstyle.org
    > Subject: Re: SingleObjectQuery & ObjectID
    >
    >
    > For the full object refresh, including relationships, do
    > DataContext.invlidateObjects(..).
    >
    > Andrus
    >
    >
    >
    > On Feb 24, 2006, at 12:33 PM, Dave Merrin wrote:
    > > Hi Andrus,
    > >
    > > cheers for that. I've now run into the problem that my to-many
    > > relationships
    > > (from the newly retrieved object)(and possibly to-one
    > > relationships) are
    > > picking data up from the cache. How can I stop this from happening?
    > >
    > > Cheers,
    > >
    > > Dave
    > >
    > >> -----Original Message-----
    > >> From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    > >> Sent: 23 February 2006 17:11
    > >> To: cayenne-use..bjectstyle.org
    > >> Subject: Re: SingleObjectQuery & ObjectID
    > >>
    > >>
    > >>
    > >> On Feb 23, 2006, at 12:00 PM, Dave Merrin wrote:
    > >>
    > >>> Hi,
    > >>>
    > >>> I've just come across the caching feature of objectForPK. This is
    > >>> causing me
    > >>> problems so I've had a look at the SingleObjectQuery. This looks
    > >>> much more
    > >>> like what I need.
    > >>
    > >> Yep, that's the way to go if you want to control cache behavior
    > >> manually.
    > >>
    > >>
    > >>> Now I'd like to modify my template to provide a method
    > >>> which creates an ObjectId given a pk value. Something a bit like:
    > >>>
    > >>> createObjectID(int value)
    > >>> {
    > >>> ObjectId result = new ObjectId(this.tablename,
    > >> this.pkColumn, value);
    > >>> return result;
    > >>> }
    > >>>
    > >>> This should be fine but what about the tables that have compound
    > >>> primary
    > >>> keys? Can I create an ObjectId given multiple columns?
    > >>
    > >> Absolutely. Look at other ObjectId constructors - ObjectId can take a
    > >> map of values.
    > >>
    > >> Andrus
    > >>
    > >
    > >
    >



    This archive was generated by hypermail 2.0.0 : Mon Feb 27 2006 - 05:06:59 EST