Re: avoid caching on fetching by primary key

From: Mahmut Izci (mahmut.izc..reenet.de)
Date: Mon Mar 06 2006 - 12:45:11 EST

  • Next message: Andrus Adamchik: "Re: avoid caching on fetching by primary key"

    Hi Michael,

    thank you much. This did not work, because cayenne is still caching.
    I changed the row in the database by another application and cayenne did
    not recognize it.

    It is possible to turn on refreshing of query results (
    query.setRefreshingObjects(true) ),
    but cayenne does not generate getters/setters for primary keys by
    default, so that queries are not possible.
    Nevertheless maybe there is a way to use a SelectQuery with primary keys.

    Mahmut
    >
    > Gentry, Michael (Contractor) schrieb:
    >> Oh yeah, to get an ObjectId, use
    >>
    >> new ObjectId("EntityName", "pkAttributeName", pk)
    >>
    >> for "primaryKey" below. Look at the constructors for ObjectId if you
    >> have compound keys/etc. Like I said, I didn't test it. :-)
    >>
    >> /dev/mrg
    >>
    >>
    >> -----Original Message-----
    >> From: Gentry, Michael (Contractor) [mailto:michael_gentr..anniemae.com]
    >>
    >> Sent: Monday, March 06, 2006 10:18 AM
    >> To: cayenne-use..bjectstyle.org
    >> Subject: RE: avoid caching on fetching by primary key
    >>
    >>
    >> I haven't tested this, but try:
    >>
    >> object = DataObjectUtils.objectForQuery
    >> (dataContext,
    >> new ObjectIdQuery(primaryKey));
    >>
    >> /dev/mrg
    >>
    >>
    >> -----Original Message-----
    >> From: Mahmut Izci [mailto:mahmut.izc..reenet.de] Sent: Monday, March
    >> 06, 2006 7:00 AM
    >> To: cayenne-use..bjectstyle.org
    >> Subject: avoid caching on fetching by primary key
    >>
    >>
    >> Hi,
    >>
    >> I'm using DataObjectUtils.objectForPK to find entries. But this method
    >>
    >> is caching the query results.
    >> Alternatively I tried to use select queries, but cayenne did not
    >> generate getters and setters for primary keys.
    >>
    >> How can i fetch by primary keys and avoid caching?
    >>
    >> Thanks
    >> Mahmut
    >>
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon Mar 06 2006 - 12:45:09 EST