Emmanuel -- If I remember correctly, the only query operations that look at the cache first, before executing the query against the db, are those that operations that involve queries that incorporate Identity objects. These are pb::getObjectByIdentity(Identity) and pb::getObjectByQuery(Query). The getObjectByQuery method will look in the cache first only if the Query object that's passed in is an instance of QueryByIdentity. For both of these methods, if the object isn't in the cache, the database will be queried, and, if a record is found, an object will be materialized, put in the cache and returned to the caller.
In all other cases, the query will be run against the database and object(s) representing the contents of the result set will be returned to the caller. However, before the PB materializes a new object, it will look in the cache to see if there's an entry with the same identity. If one is found, then another won't be materialized. The object that's in the cache will be used. If there's no matching entry in the cache, a new object will be materialized, put in the cache and returned to the user. Bottom line...If the query you're running includes an Identity, the database will be queried only if there's no object in the cache with the same identity. If the query doesn't include an Identity, then the database will be queried each time. HTH Ron Gallagher Atlanta, GA [EMAIL PROTECTED] database will be > > From: "Emmanuel Dupont" <[EMAIL PROTECTED]> > Date: 2003/06/13 Fri PM 12:28:44 EDT > To: "OJB Users List" <[EMAIL PROTECTED]> > Subject: My Ojb cache doesn't work ?? > > All, > > > > > > Here is my code > > > > // Criterias... > > Criteria crit = new Criteria(); > > crit.addEqualTo(Alt_log.LOG_ID_PK,"Essai" ); > > Query q = QueryFactory.newQuery(Alt_log.class, crit); > > > > // Start the Db transaction > > broker.beginTransaction(); > > > > altLogEdited = (IAlt_log)broker.getObjectByQuery(q); > > tx.lock(altLogEdited, JwtTransaction.READ); > > > > altLogEdited = (IAlt_log)broker.getObjectByQuery(q); > > > > > // Release the db connection to PoolConnection manager.... > > broker.commitTransaction(); > > > > tx.commit(); > > > > > > > > The getObjectByQuery method execute on the both calls a Select in the > Database. > > > > I don't put "true" in the class_descriptor "refresh" option > > > > For me, OJB should'nt look to the database on the second call ...isn't it > ???? > > > > > > Tx ! > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
