ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oscar Picasso <oscgoo...@yahoo.com>
Subject Bidirectional parent-child relationship and groupBy
Date Thu, 07 Apr 2005 16:04:38 GMT

I have something like that:

class Category
  int id;
  List<Subcategory> subcategories;
  ..getters and setters

class Subcategory
  int id;
  Category parent;
  ..getters and setters

A groupBy in the Category resultMap loads the related subcategories. 

However while loading these subcategories, I would like each subcategory parent
to be set.

I can use lazy loading but it can set a different parent for the subcategories
under a same Category (!= identity => more objects created).

Is there a mean to do that in the result Map (set the subcategory parent to the
same Category in a group).

Currently, I do it in the dao code but I don't find this solution very clean.



Yahoo! Messenger 
Show us what our next emoticon should look like. Join the fun. 

View raw message