db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mahler Thomas <thomas.mah...@itellium.com>
Subject RE: [proposal] Proxy prefetching
Date Mon, 15 Sep 2003 09:03:31 GMT
I'm +1 to have this as default behaviour.
But I'd like to make it configurable on a per class base. SO we would need
an additional attribute in the class-descriptor.

Thomas

> -----Original Message-----
> From: Oleg Nitz [mailto:on@ukr.net]
> Sent: Sunday, September 14, 2003 11:55 PM
> To: OJB Developers List
> Subject: [proposal] Proxy prefetching
> 
> 
> Hi All,
> 
> I am going to implement the feature described below and 
> propose to turn it on  
> by default or even always. I'd like to know your opinions on 
> this: should it 
> be configurable or not and if yes, what should be the default 
> behavior.
> 
> Now the idea. You all know such classes as Article and 
> ProductGroup, I will 
> use them as example. Assume that we load the collection of 
> Articles by some 
> query. They all refer to ProductGroups. Assume that we do 
> something like 
> this:
> 
>     Collection col = pb.getCollectionByQuery(query);
>     for (Iterator it = col.iterator(); it.hasNext(); )
>     {
>         Article article = (Article) it.next();
>         doSomething(article.getProductGroup().getGroupName());
>     }
> 
> If ProductGroup class wasn't describes with 
>    proxy="org.apache.ojb.broker.ProductGroupProxy"
> in repository.xml, then all the referred ProductGroups would 
> be loaded by one 
> query due to the recently added batch retrieval feature. But 
> with proxy each 
> ProductGroup instance would be loaded by separate query. I 
> propose to load 
> them all by one query: if user called 
> getProductGroup().getGroupName() for 
> the first article in the collection, most probably user will 
> call this for 
> all articles, and I propose to prefetch them. If user don't use 
> ProductGroup's fields, like this
> 
>     Collection col = pb.getCollectionByQuery(query);
>     for (Iterator it = col.iterator(); it.hasNext(); )
>     {
>         Article article = (Article) it.next();
>         doSomething(article.getArticleName());
>     }
> 
> then no ProductGroups will be loaded at all, as previously.
> Similarly for CollectionProxies.
> So, what do you think?
> 
> Regards,
>  Oleg
> 
> P.S. Prefetching in JBoss CMP 2.0 works in a similar way.
> 
> 
> 
>    	  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message