I was looking through the toplink api and they have a really nice
feature that really speeds up the performance of some queries when you
know you are going to access some of the children objects by going ahead
and loading them at initial query time.  

See the reference to the feature for this at (I think you have to have a
technet id but maybe not)
http://technet.oracle.com/docs/products/ias/doc_library/90200doc_otn/toplink.903/b10064/performa.htm#1025931


So for instance say you have 2 objects Item and Group

Item has as a member exacty one group.

Currently(at least with my limited knowledge of OJB) with a query by
collection you would generate N + 1 SQL statements.  One for the query
of the Item Collection  and one subsequent query to retrieve the Group 
for each Item returned by the Query. It would be nice if you could
specify ahead of time that you wanted to go ahead and load both in the
same query. So a SQL statement like this would generated ...

        SELECT item.col1,item.col2,group.col1,group col2  
        FROM item INNER JOIN group on group.group_id = item.group_id,

This would really be a performance enhancement when you know you are
going to accessing the group ahead of time.

In the top link api they use the following syntax to indicate that they
want to load the attribute in oneQuery,

query.addJoinedAttribute("group.col2");

Then the persistence layer is able to examine that and know what to do.

How would hard would this be to do for OJB?

The toplink API is also able to handle loading children collections in
two queries using a select distinct sql statement after loading the
initial collection .

I hope this made sense, if not please read the TOPLINK docs cause it
does a much better job of explaining this than me..

This feature would be really nice...

Scott




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to