ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Benedict <paul4chris...@yahoo.com>
Subject ResultMap for nested object?
Date Fri, 04 Nov 2005 05:44:33 GMT
I see examples for getting collections like this:

class Family {
  int id;
  List children;
}

<resultMap id="familyMap" class="Family" groupBy="id">
  <result property="id" column="id" />
  <result property="children" resultMap="childMap"/>
</resultMap>

But what about reusing result maps to retrieve nested
objects? I would like to be able to do something like
the following but I haven't been able to succeed:

class Parent {
  int id;
  Child child;
}

<resultMap id="parentMap" class="Parent">
  <result property="id" column="id" />
  <result property="child" resultMap="childMap"/>
</resultMap>

See? I am trying to reuse the map, but I keep getting
this error instead: "Error instantiating collection
property for mapping 'child'.  Cause:
java.lang.ClassCastException"

Come on iBATIS gurus - show me the answer! :)


		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

Mime
View raw message