ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Bauld <bau...@cpsc.ucalgary.ca>
Subject Re: Is there a way to use right and left joins in a N+1 ?
Date Tue, 30 May 2006 08:01:53 GMT
Yea, I think I have a gotcha, A stakeholder can be pulled from the DB 
with no votes. Running the query manually yields one row for said 
stakeholder with all vote information as null.

Dont have the objects, resultmaps, and structures on this computer. I 
think I will just build a second query to load missing stakeholders that 
have no votes. And keep the first for the performance boost of not 
having to run a query for each stakeholder to get their votes.

Larry Meadors wrote:
> I wouldn't expect that to make a difference as you have described it
> so far, but without some more context, I can't say for sure.
> Maybe you can provide some more info - data structures, mapped
> statements, and result maps would be a good start.
> I would expect this to work pretty easily (I know I have done groupBy
> with outer joins), but the one gotcha I saw was that if the outer
> table (votes in your case) had no matches, then the main object
> (stakeholder) had a list with one (all null) element in it...which
> makes sense if you think about it - since that is what is in the
> result set.
> Larry
> On 5/29/06, Eric Bauld <baulde@cpsc.ucalgary.ca> wrote:
>> This will work for group by resultmaps ?
>> A vote is not an int, a vote is a object.
>> A stakeholder object holds a list of vote objects. Do you mean just
>> changing all my basic accessors to use objects instead of primitives for
>> this to work ?
>>  - Eric
>> Sven Boden wrote:
>> > Use Integer instead of int in your domain objects, Float instead
>> > float, ...
>> >
>> > Regards,
>> > Sven
>> >
>> > Eric Bauld wrote:
>> >
>> >> I am trying to get a query to run that has the following
>> >> Get a list of stakeholders
>> >> Each stakeholder can have many votes
>> >>
>> >> I want all stakeholders even if they do not have a vote.
>> >>
>> >> I have the query done and will get all stakeholders and all of their
>> >> votes loaded properly. But if a stakeholder has no votes ibatis
>> >> explodes because it cannot assign any votes to that stakeholder. How
>> >> can I get around these null values and have it build a stakeholder
>> >> object and not load it with votes ?
>> >>
>> >> - Eric
>> >>
>> >>

View raw message