Suppose,
customerBean has a one-to-many relationship with accountBean
accountBean has a one-to-one relationship with addressBean
customerBean has a one-to-one relationship with phoneBean

then what about
<read-ahead>
   <!-- read customers -->
   <strategy>on-load</strategy>
   <page-size>100</page-size>
   <eager-load-group>customer_group</eager-load-group>

   <!-- read customer's accounts -->
   <read-ahead>
      <cmr-field>accounts</cmr-field>
      <strategy>on-load</strategry>
      <page-size>10</page-size>
      <eager-load-group>account_group</eager-load-group>
      <!-- read account's address -->
      <read-ahead>
         <cmr-field>address</cmr-field>
         <strategy>on-find</strategry>
         <eager-load-group>address_group</eager-load-group>
      </read-ahead>
   </read-ahead>

   <!-- read customer's phone -->
   <read-ahead>
      <cmr-field>phone</cmr-field>
      <strategy>on-find</strategry>
      <eager-load-group>phone_group</eager-load-group>
   </read-ahead>
</read-ahead>

Note, sql statements for these queries could return duplicates.

alex

Wednesday, October 23, 2002, 5:23:30 AM, you wrote:

DS> I totally agree and this is already planned for JBoss 4.0.  The real 
DS> problem is not the code to do the loading but figuring out a simple xml 
DS> structure to define the loading.

DS> -dain

DS> Emerson Cargnin - SICREDI Servi�os wrote:
>> I have a suggestion regarding to CMP : why not create a configuration to 
>> a find method to allow the container to load the relationships of a bean?
>> 
>> This could be useful in the cases you have to read all the beans(or a 
>> good amount of then) and all (or almost all) relationships of them. eg : 
>> in a report you will have a sql to finding the pk's, one (at least) to 
>> load the bean data and one sql to each relation you have to report (for 
>> each bean).
>> 
>> I think that one of the worse problem with CMP is that : database 
>> overhead. CMP generates too much sql commands that in some cases could 
>> be handled by fewer (if not one) sql commands. The DBA's in my company 
>> didn't like very much the trace they saw in the database for a very 
>> simple app.

-- 
Best regards,
 Alex Loubyansky




-------------------------------------------------------
This sf.net email is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0002en

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to