i ve done the test similar to the ones martin did:

1. load an object with Database.load(), update the mapping row in the underlying
db outside castor, then see if the value load again is updated or not
2. load an object using OQLQuery, update the mapping row in the underlying db
outside castor, then see if the value load again is updated or not

i found that both method will not have the value updated(both use caching if
mapping has defined to use caching)!
but y is the one using OQLQuery is much slower?


regards,

dave
----- Original Message -----
From: "Martin, Margaret" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 20, 2002 00:17
Subject: Re: [castor-dev] HOw to make cache works?


> Let me clarify - I loaded an object, the data was updated outside of castor,
> and then I attempeted a query to load the object by id. The value that was
> returned was the same as the originally loaded object. Based on this thread,
> I expected that I would get the data loaded directly from the database
>
> -----Original Message-----
> From: Martin, Margaret [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 19, 2002 10:04 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] HOw to make cache works?
>
>
> This sounds good in theory, but I attempted a query by id, and ended up with
> the same results as db.load()... is this only for a query by some other
> means than id?
>
> -----Original Message-----
> From: Low Heng Sin [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 19, 2002 2:48 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] HOw to make cache works?
>
>
> Yes, OQL query always hit the db. However, the end result is the same as oql
> query delegate to db.load() to get the actual object.
>
> Regards,
> Low
>
> -----Original Message-----
> From: David Tam [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 19, 2002 4:41
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] HOw to make cache works?
>
>
> thanks for your reply.
> so, the caching onlys works for db.load() rt?
> but in the API doc it says db.load() is the same as doing an OQL query?
> so can anyone clarify on this?
> i ve done test with db.load(), and it turns out the performance is much
> better(i
> think it is because with the caching).
>
>
> regards,
>
> dave
> ----- Original Message -----
> From: "Bert van Brakel" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, March 19, 2002 16:34
> Subject: Re: [castor-dev] HOw to make cache works?
>
>
> > Why not use
> >
> > aBroker = (og_Broker) db.load( og_Broker.class, brokerNbr)
> >
> > I guess if you do a query it has to run it through the db to see if any
> > identity fields match. I suppose it doesn't distinguish between an
> identity
> > field and other fields when doing a query.
> >
> > Bert.
> >
> > --- David Tam <[EMAIL PROTECTED]> wrote:
> > > sorry but i dont know y the msg is cut off.
> > > here is the problem again:
> > >
> > > the following is my mapping:
> > >
> > > /***********************************************/
> > >  <class name="og_Broker" access="read-only" identity="brokerCde" >
> > >   <description>just a testing mapping for trying out
> castor</description>
> > >   <cache-type type="count-limited" capacity="30"/>
> > >   <map-to table="OGT_BKR" />
> > >   <field name="brokerCde" type="string" required="true">
> > >    <sql name="BKR_CDE" type="varchar" />
> > >   </field>
> > >  </class>
> > > /***********************************************/
> > >
> > > and the following is my code:
> > >
> > > /***********************************************/
> > >     public static og_Broker get(String brokerNbr) throws Exception{
> > >
> > >   Database  db;
> > >   Query   oql;
> > >   QueryResults results;
> > >   og_Broker aBroker = null;
> > >
> > >   db = myJDO.instance().getDatabase();
> > >
> > >   db.begin();
> > >   oql = db.getOQLQuery( "SELECT p FROM og_Broker p WHERE brokerCde=$1"
> );
> > >   oql.bind(brokerNbr);
> > >
> > >   results = oql.execute();
> > >
> > >   if ( results.hasMore() ) {
> > >    aBroker = (og_Broker) results.next();
> > >   } else {
> > >    throw new Exception("user not found");
> > >   } // end if
> > >
> > >   db.commit();
> > >   results.close();
> > >   oql.close();
> > >   db.close();
> > >   return aBroker;
> > >  } // end get
> > > /***********************************************/
> > > and here is my very simply test on caching:
> > >
> > > /***********************************************/
> > > public class myCastorTest{
> > >
> > >  public static void main(String args[]){
> > >
> > >   try{
> > >    System.out.println(og_Broker.get(args[1]).toString());
> > >    for (int i = 0; i < 100; i++){
> > >     og_Broker aBkr = og_Broker.get(args[1]);
> > >    }
> > >   }catch(Exception e){
> > >    e.printStackTrace();
> > >   }
> > >  }
> > >
> > > } // end myCastorTest
> > >
> > > /***********************************************/
> > >
> > > and it seems castor goes to the DB every time for the same copy which
> should
> > > be
> > > able to get from cache?
> > >
> > >
> > > regards,
> > >
> > > dave
> > >
> > >
> > > _______________________
> > > CONFIDENTIALITY NOTICE:
> > >
> > > This message, together with any attachment, is intended only for the use
> of
> > > the individual or entity to whom it is addressed and contains
> information
> > > that is privileged and confidential.  If you are not the intended
> recipient,
> > > please be informed that any dissemination, distribution or reproduction
> of
> > > this message (including any attachment) is strictly prohibited.  If you
> have
> > > received this message in error, please notify us immediately by return
> e-mail
> > > and delete the original message.  Thank you.
> > >
> > > -----------------------------------------------------------
> > > If you wish to unsubscribe from this mailing, send mail to
> > > [EMAIL PROTECTED] with a subject of:
> > > unsubscribe castor-dev
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Sports - live college hoops coverage
> > http://sports.yahoo.com/
> >
> > -----------------------------------------------------------
> > If you wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> > unsubscribe castor-dev
> >
>
>
> _______________________
> CONFIDENTIALITY NOTICE:
>
> This message, together with any attachment, is intended only for the use of
> the individual or entity to whom it is addressed and contains information
> that is privileged and confidential.  If you are not the intended recipient,
> please be informed that any dissemination, distribution or reproduction of
> this message (including any attachment) is strictly prohibited.  If you have
> received this message in error, please notify us immediately by return
> e-mail and delete the original message.  Thank you.
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>


_______________________
CONFIDENTIALITY NOTICE:

This message, together with any attachment, is intended only for the use of the 
individual or entity to whom it is addressed and contains information that is 
privileged and confidential.  If you are not the intended recipient, please be 
informed that any dissemination, distribution or reproduction of this message 
(including any attachment) is strictly prohibited.  If you have received this message 
in error, please notify us immediately by return e-mail and delete the original 
message.  Thank you.

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to