ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: solution for N+1 selects
Date Mon, 17 Jan 2005 21:45:57 GMT
Hmmm... I can see we really need good documentation around this.

By simple nature of a join, you MUST use groupBy.  Otherwise you'll
end up with too many parent objects.  You can use queryForList or
queryForObject with the solution, as long as the latter only returns a
single parent object.

Regardless, you can use the resultMap and groupBy independently as
required.  You just combine them to eliminate repeating groups for a
complex object graph.

Cheers,
Clinton




On Mon, 17 Jan 2005 16:16:42 -0500, Tim_Hammar@mcnichols.com
<Tim_Hammar@mcnichols.com> wrote:
>  
> I'm having trouble implementing the 2.0.9 N+1 solution.  The example posted
> on the wiki deals with a groupBy relationship.  Is this the only situation
> where the fix applies?  I have a simple nested 1:M relationship that I would
> love to used this new feature with.  Presently I am using the old method of
> using a "select " parameter in the result element of my resultMap.  I have
> replaced this parameter with a "resultMap" parameter.  Of course I have
> changed the SQL to join the necessary tables.  Must I change my query to a
> QueryForList and build my result manually or should I be able to use the
> same queryForObject that I was using before?  I am getting an
> executeQueryForObject returned too many results exception. 
> _______________________________________
>  Tim Hammar
>  Senior Programmer Analyst
>  McNichols Company
>  5501 W. Gray Street, Tampa, FL 33609-1007
>  P.O. Box 30300, Tampa, FL 33630-3300
>  Local: 813-282-3828, ext. 2419
>  Fax: 813-287-8387
>  tim.hammar@mcnichols.com
>  www.mcnichols.com

Mime
View raw message