You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Magnus Stattin <ma...@cue.se> on 2005/01/28 07:35:01 UTC
Simple example of N+1 selects
Hi
How would I be able to avoid the N+1 selects if I have for example a
departments table and a table with employees. All employees belongs to a
department and I would like to get a list of department valueObjects where
each departmentVo contains a collection of employee valueObjects.
Is it possible to do this with a single select with Ibatis and how would the
Sqlmap look like. I am looking for a simple example to get me started.
Thank you
Magnus
Re: Simple example of N+1 selects
Posted by Kris Jenkins <kr...@yahoo.co.uk>.
Magnus Stattin wrote:
>Hi
>
>How would I be able to avoid the N+1 selects if I have for example a
>departments table and a table with employees. All employees belongs to a
>department and I would like to get a list of department valueObjects where
>each departmentVo contains a collection of employee valueObjects.
>
>Is it possible to do this with a single select with Ibatis and how would the
>Sqlmap look like. I am looking for a simple example to get me started.
>
>Thank you
>
>Magnus
>
>
Take a look at this wiki FAQ:
http://wiki.apache.org/ibatis/How_20do_20I_20get_20around_20the_20n_2b1_20selects_20problem_3f
Kris
--
Kris Jenkins
Email: kris@jenkster.com
Blog: http://cafe.jenkster.com/
Wiki: http://wiki.jenkster.com/