You can try lazyLoad="true" for the select attribute.

On the Java-side, there's the "group by" attribute (feature request for C#?):

http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I+get+around+the+N+Plus+1+selects+problem%3F

Roberto



On 8/16/05, Shawn Smiley <[EMAIL PROTECTED]> wrote:
Is it possible to populate an object tree from a
single query?  Here is an example of what I'm trying
to do:

I have an Orders table which is a parent to an
OrderDetails table which references a Products table.
I also have C# classes that mirror the fields in each
table.

I want to run a single query like:
SELECT O.*, OD.*, P.*
FROM Orders O
INNER JOIN OrderDetails OD ON O.OrderID=OD.OrderID
INNER JOIN Products P ON OD.ProductID=P.ProductID
WHERE O.OrderID=#value#

And have iBatis generate 1 Order object that contains
an IList of OrderDetail objects with each OrderDetail
Object having a Product object.

Currently I'm doing this using the select attribute on
the result field in the data map.  Unfortunately I'm
already seeing performance problems in my development
environment with just a handful of records in the dev
database.

So what is the best way to accomplish my goal?  Do I
need to write a custom data handler and have that
parse the result set into the individual objects?

Thanks,
Shawn.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Reply via email to