Simple retrieval of an object by PK

From: Jonathan Carlson (Jonathan.Carlso..atun.com)
Date: Thu Jul 15 2004 - 16:17:36 EDT

  • Next message: Mike Kienenberger: "Re: Simple retrieval of an object by PK"

    I gravitate towards powerful tools that make simple things simple and hard things possible. I know that Cayenne is in this category of tools, but I don't see any way to simply and quickly retrieve an instance by it's primary key -- something that should be very easy and concise.

    For example, when doing web apps this seems like a common use case:
    1) Display a list of instances that each have a link to an edit page. (For example, each link would include a ?pk=999 request parameter which is not visible on the HTML page.)
    2) When the link is clicked, the action class grabs the pk request param and does a quick lookup of the obect before rendering the edit page.

    There must be a straightforward simple API to get an object by its PK without having to do 6 lines of code to setup a query, expression, params, and execution. It's really easy to grab all instances of an ObjEntity, why shouldn't it be just as easy to grab one instance?

    (BTW, I think DataContext.refetchObject(ObjectId oid) is on the right track towards the simplicity I'm looking for, but that doesn't appear to fill the need)

    Thanks in advance for any tips you might have in this area. It's possible I just missed something, but I think I've read all the relevant documentation.

    Thanks again,

    Jonathan

    *********************************************************************************
    This email and any files transmitted with it are confidential and
    intended solely for the use of the individual or entity to whom they
    are addressed. If you have received this email in error please notify
    the system manager.

    Katun Corporation -- Celebrating 25 Years of Service
    www.katun.com
    *********************************************************************************



    This archive was generated by hypermail 2.0.0 : Thu Jul 15 2004 - 16:23:16 EDT