This may have been asked a couple of times, but I haven't seen a useful answer yet. My domain model has a parent-child relationship, but the child also needs to have a reference to the parent object. Something like
Group { int groupId; String groupName; List<Item> items; ..... ..... } Item { int itemId; String itemName; Group parentGroup; ....; } How do I express this relationship in a resultMap? I tried the following, but it gives me a StackOverflowError when I try to run a <select> query with a join between the Group and Item tables: <resultMap id="groupMap" type="GroupDTO"> <id property="groupId" column="groupId"/> <collection property="items" resultMap="itemMap"/> </resultMap> <resultMap id="itemMap" type="ItemDTO"> <id property="itemId" column="itemId"/> <result property="objectId" column="objectId"/> <result property="objectType" column="objectType"/> <association property="parentGroup" column="groupId" resultMap="groupMap"/> </resultMap> I'm sure I'm doing something wrong here with the circular reference, but I don't know what's the right way to do this. I have seen statements on this list referring to this issue being solved by the iBATIS cache, but I'm not sure how. Can anyone help, or point me to the solution? (Hibernate does this kind of stuff easily, but sucks for many other reasons) Thanks - rtrip -- View this message in context: http://www.nabble.com/Bidirectional-association-in-iBATIS-3--tp25299690p25299690.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org