RE: Query and the cache

From: JR Ruggentaler (j..pv.com)
Date: Mon Aug 12 2002 - 23:36:34 EDT

  • Next message: Andrus: "[Logging] Was: Query and the cache"

    >At 09:51 PM 8/12/2002 -0500, JR Ruggentaler wrote:
    >>I was trying to create and register several objects with Cayenne before
    >>calling commitChanges to optimize access to the database. During my object
    >>creation I query Cayenne to see if the object I want to add already exist.
    >>The query seems to be unable to return new uncommitted objects from
    >>Cayenne's cache. Is this by design, an unimplemented future feature, or a
    >>bug?

    >This is by design. Queries always return fresh data from the database,
    >ignoring uncommitted objects. Could you explain why you need that, we may
    >think of a workaround?

    I am adding thousands of records to my database in a backend application and
    only wanted to save say every 100 records to increase performance. I don't
    have much experience with EOF but doesn't it return query results from both
    the cache and the database?

    Will the update to use log4j fallback to Java logging if log4j can't be
    found? Is log4j required with the new build? Will log4j be distributed with
    Cayenne? It would be nice if Cayenne provided a wrapper around the logging
    mechanism. The user could then choose to use log4j, Java logging or
    implement their own logging.

    -----Original Message-----
    From: Andrus [mailto:andru..bjectstyle.org]
    Sent: Monday, August 12, 2002 10:05 PM
    To: JR Ruggentaler; 'cayenne-use..bjectstyle.org'
    Subject: Re: Query and the cache

    At 09:51 PM 8/12/2002 -0500, JR Ruggentaler wrote:
    >I was trying to create and register several objects with Cayenne before
    >calling commitChanges to optimize access to the database. During my object
    >creation I query Cayenne to see if the object I want to add already exist.
    >The query seems to be unable to return new uncommitted objects from
    >Cayenne's cache. Is this by design, an unimplemented future feature, or a
    >bug?

    This is by design. Queries always return fresh data from the database,
    ignoring uncommitted objects. Could you explain why you need that, we may
    think of a workaround?

    >How do I turn off Cayenne logging? I tried:
    >org.objectstyle.cayenne.conf.Configuration.setLogLevel(java.util.logging.Le
    v
    >el.OFF);

    Query logging is handled by the QueryLogger class, which is separate from
    Configuration logging. Here is a quick way to configure this.

    1. If you are using release 1.0a2 that is based on JSDK 1.4 logging API, go
    to JRE_HOME/lib and edit standard file called "logging.properties". Add the
    following line somewhere in the bottom:

    org.objectstyle.cayenne.access.QueryLogger.level = SEVERE

    2. This is already replaced by log4j API in the nightly builds (since
    yesterday nightly build Cayenne can be deployed with JDK 1.3, finally). So
    if you are using latest nightly build, create the file
    $HOME/.cayenne/cayenne-log.properties with the contents similar to this:

    # turn off logging
    log4j.rootLogger=WARN, A1
    log4j.appender.A1=org.apache.log4j.ConsoleAppender
    log4j.appender.A1.layout=org.apache.log4j.PatternLayout
    log4j.appender.A1.layout.ConversionPattern=[%-5p %c{1}] %m%n

    # turn on indiv. packages
    #log4j.logger.org.objectstyle.cayenne = DEBUG
    log4j.logger.org.objectstyle.cayenne.access = ERROR



    This archive was generated by hypermail 2.0.0 : Mon Aug 12 2002 - 23:36:31 EDT