You could do it with a ResultHandler in a single pass.
Larry
On Mon, Sep 13, 2010 at 7:03 AM, Andrius Juozapaitis <
[hidden email]> wrote:
> Hey,
>
> One common scenario I have in the application I am creating, is the
> need to quickly access the objects from the results by their primary
> key. At the moment, I achieve this by simply iterating the list with
> the results (say, List<DatabaseEntity>) and creating such a map (for
> example, Map<Integer, DatabaseEntity>) in my utility class. This means
> additional memory and cpu cycles, not to mention code duplication. I
> am pretty sure I didn't see anything like this in the mybatis code,
> but just wanted to confirm that am on the right track. Any hints
> there?
>
> regards,
> Andrius
>