ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mukul Goyal <mg...@yahoo.com>
Subject N+1 select and object references
Date Wed, 14 Sep 2005 12:46:43 GMT
I noticed that it is required (only when you are using the N+1 solution) for an Object that
contain other objects (1:M relationships) to have BOTH a getter and setter method. At first
I didn't realize why this was required, but as I was debugging a problem I realized why. 
If the getter returns NULL during object population, IBATIS constructs a new List object and
calls the setter on the parent object. However, when the setter is called the List is empty.
The IBATIS implementation banks on the fact that you are maintaining the object inside of
your bean. After it calls the setter with the empty List, it then goes and populates the List.
I put a break point in my settter method and realized that the size of the list is never greater
than 0. This seems problematic because internally I do not represent the content of the data
as a list.
Is this by design or is there a work around to this problem?

Yahoo! for Good
 Click here to donate to the Hurricane Katrina relief effort. 
View raw message