ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Goodin <brandon.goo...@gmail.com>
Subject Re: N+1 select and object references
Date Thu, 15 Sep 2005 12:32:46 GMT
If you could provide more information about where this behavior is in
iBatis as well as the code you are using to call it, that'd help us to
see better what you are talking about.

Thanks
Brandon

On 9/14/05, Mukul Goyal <mg282@yahoo.com> wrote:
> 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? 
>   
> Thanks, 
> Mukul 
> 
> 
>  ________________________________
> Yahoo! for Good
>  Click here to donate to the Hurricane Katrina relief effort. 
> 
>

Mime
View raw message