You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "ron riley (JIRA)" <ib...@incubator.apache.org> on 2006/03/30 13:12:26 UTC

[jira] Commented: (IBATIS-278) sqlmap support resultMap for abstract class

    [ http://issues.apache.org/jira/browse/IBATIS-278?page=comments#action_12372413 ] 

ron riley commented on IBATIS-278:
----------------------------------

This problem occurs if the superclass, e.g. Animal, class is abstract and a new, unmapped, subclass is introduced into the data.  E.g. if, in this example, a 'Reptile' is added as an ANIMAL_SUBCLASS but not mapped, when iBatis will try to create an Animal:  it would be nice if the resultMap element supported an 'abstract' attribute and even better if it could throw an 'Unmapped Discriminator' exception.

> sqlmap support resultMap for abstract class
> -------------------------------------------
>
>          Key: IBATIS-278
>          URL: http://issues.apache.org/jira/browse/IBATIS-278
>      Project: iBatis for Java
>         Type: Improvement
>   Components: SQL Maps
>     Versions: 2.1.7
>     Reporter: ron riley
>     Priority: Minor

>
> please allow for abstract superclasses to be mapped in resultMaps, to support, for example:
> 	<resultMap class="Animal" id="lazyAnimal">
> 		<result property="name" column="ANIMAL_NAME" />
> 		<discriminator javaType="string" column="ANIMAL_SUBCLASS">
> 			<subMap value="canine" resultMap="canine"/>
> 			<subMap value="feline" resultMap="feline"/>
> 		</discriminator>
> 	</resultMap>
> 	
> 	<resultMap class="Feline" id="feline">
> 		<result property="name" column="ANIMAL_NAME" /><!-- dtd requires a property to be mapped -->
> 	</resultMap>
> 	<resultMap class="Canine" id="canine">
> 		<result property="name" column="ANIMAL_NAME"/>
> 	</resultMap>
> at present this example gets an instantiation exception if the Animal class is abstract. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira