oh.
this is because i can see the following log from the printwriter output:

SELECT
"OGT_BKR"."BKR_CDE","OGT_BKR"."BKR_NAM","OGT_BKR"."BKR_NBR","OGT_BKR"."STAT_IND"
,"OGT_BKR"."LAST_MOD_ID","OGT_BKR"."LAST_MOD_TME","OGT_BKR"."SUSP_IND" FROM
"OGT_BKR" WHERE ("OGT_BKR"."BKR_CDE" = ?)
Castor: Loading og_Broker (1028)
SELECT
"OGT_BKR"."BKR_CDE","OGT_BKR"."BKR_NAM","OGT_BKR"."BKR_NBR","OGT_BKR"."STAT_IND"
,"OGT_BKR"."LAST_MOD_ID","OGT_BKR"."LAST_MOD_TME","OGT_BKR"."SUSP_IND" FROM
"OGT_BKR" WHERE ("OGT_BKR"."BKR_CDE" = ?)
Castor: Loading og_Broker (1028)
SELECT
"OGT_BKR"."BKR_CDE","OGT_BKR"."BKR_NAM","OGT_BKR"."BKR_NBR","OGT_BKR"."STAT_IND"
,"OGT_BKR"."LAST_MOD_ID","OGT_BKR"."LAST_MOD_TME","OGT_BKR"."SUSP_IND" FROM
"OGT_BKR" WHERE ("OGT_BKR"."BKR_CDE" = ?)
Castor: Loading og_Broker (1028)

and it runs for about 8-10 sec before it returns.
i have also found that if i change the OQLQuery to db.load() then the code takes
less than 1 sec before it return.
so does it mean caching only works for the db.load() statement?


regards,

dave
----- Original Message -----
From: "Smith, Kevin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 18, 2002 21:53
Subject: Re: [castor-dev] HOw to make cache works?


> How do you know that its going back to the database? Have you stepped thru
> the code to see if it is using the internal caches?
>
> -----Original Message-----
> From: David Tam [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, March 17, 2002 8:30 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] HOw to make cache works?
>
>
> 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
>
> -----------------------------------------------------------
> 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