Yes, which mean always use db.load if u are loading object by primary key.
Don't forget there is also the overhead of oql parsing.

Regards,
Low

-----Original Message-----
From: David Tam [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 5:41
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] HOw to make cache works?


dear low,

so are you saying for the two different methods (OQL query and db.load())
the
results retrieved from the database are always the same(if only one row is
returned), but the performance could have a huge difference(due to caching)?

cheers!

regards,

dave
----- Original Message -----
From: "Low Heng Sin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 19, 2002 16:47
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
>


_______________________
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

Reply via email to