You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Ilya Boyandin <Il...@fh-joanneum.at> on 2007/09/03 10:39:17 UTC

Using discriminator with an interface

Hello all,

is that possible to use discriminator with an interface without setters?

I have something like this in my mappings:

<resultMap id="somethingResult" class="ISomething">
    <discriminator column="type" javaType="string">
        <subMap value="black" resultMap="blackSomethingResult"/>
        <subMap value="white" resultMap="whiteSomethingResult"/>
    </discriminator>
</resultMap>

<resultMap id="blackSomethingResult" class="BlackSomething">
    ...
</resultMap>

<resultMap id="whiteSomethingResult" class="WhiteSomething">
    ...
</resultMap>

<select id="loadSomething" resultMap="somethingResult">
    ...
</select>

And I always get this RuntimeException: "resultMap 
Something.somethingResult must have at least one result mapping". But 
somethingResult can't have any mappings because ISomething is an 
interface without any setters.

Am I doing something wrong or is there any other way to accomplish this?

Thanks in advance
Ilya




FH JOANNEUM Gesellschaft mbH
Rechtsform/Legal form: GmbH
Firmenbuchgericht/Court of registry: Landesgericht für ZRS Graz
Firmenbuchnummer/Company registration: FN 125888 f
DVR: 0813559
UID-Nr.: ATU 42361001