How could iBATIS throw an InstantiationException when you're not even telling it the name of your abstract class? Please post the full exception stacktrace and your result maps.
Niels -----Original Message----- From: Kenny Pearce [mailto:[EMAIL PROTECTED] Sent: woensdag 12 september 2007 20:46 To: user-java@ibatis.apache.org Subject: abstract property Hello, I am trying to use iBatis in a case where I have an object hierarchy like the following: class Foo{ String fooString; Bar myBar; //getters and setters omitted } abstract class Bar{ String barString; //getters and setters omitted } class SubBar extends Bar{ String subBarString; //getters and setters omitted } I would like to be able to do this: <resultMap id="fooResultMap" class="Foo"> <result property="fooString" column="foo"/> <result property="myBar" resultMap="barResultMap"/> </resultMap> <resultMap id="barResultMap" class="SubBar"> <result property="barString" column="bar"/> <result proprty="subBarString" column="sub_bar"/> </resultMap> <select id="fooSelect" parameterClass="string" resultClass="Foo" resultMap="fooResultMap"> SELECT foo, bar, sub_bar FROM table WHERE foo = #value# </select> But that gives an InstantiationException (despite the fact that the barResultMap has the class SubBar, which is concrete, specified). Next I tried using a discriminator and making a separate barResultMap and subBarResultMap (where subBarResultMap extends barResultMap) with <subMap value="*" ...> on a column that is never null (I'm not sure if wildcard is supported - I couldn't find discriminator in the docs, but it's not listed on the undocumented features page). That still threw an exception. Next, I changed the select statement to (the equivalent of): SELECT foo, bar, sub_bar, 1 as use_submap FROM table WHERE foo = #value# and used: <discriminator column="use_submap" javaType="int"> <subMap value="1" resultMap="subBarResultMap"/> </discriminator> But no go there either. Is there any way to do this, short of creating a custom object factory? Thanks, -- Kenny Pearce Hx Technologies