DataObjectUtils.objectForPK

From: Michael Lepine (mikelepin..mail.com)
Date: Wed Nov 28 2007 - 15:55:23 EST

  • Next message: Aristedes Maniatis: "Re: DataObjectUtils.objectForPK"

    I noticed that the convenience methods in the DataObjectUtils class only
    execute a query if the object is not already cached. Is there a way to force
    the methods to issue a query to the database? I've included an excerpt of
    the javadocs for 2.0 below.

    public static DataObject
    <http://cayenne.apache.org/doc20/api/cayenne/org/apache/cayenne/DataObject.html>
    *objectForPK*(ObjectContext
    <http://cayenne.apache.org/doc20/api/cayenne/org/apache/cayenne/ObjectContext.html>
    context,
                                         java.lang.Class dataObjectClass,
                                         java.lang.Object pk)

     Returns an object matching an Object primary key. If the object is mapped
    to use a compound PK, CayenneRuntimeException is thrown.

    If this object is already cached in the ObjectStore, it is returned without
    a query. Otherwise a query is built and executed against the database.
    Thanks for the help.

    - Mike



    This archive was generated by hypermail 2.0.0 : Wed Nov 28 2007 - 15:56:03 EST