Re: SingleObjectQuery & ObjectID

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Feb 23 2006 - 12:10:44 EST

  • Next message: emre.yilma..r.net: "Re:Re: Prefetched Query"

    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 : Thu Feb 23 2006 - 12:10:46 EST