On 5/9/05, Ron Grabowski <[EMAIL PROTECTED]> wrote:
> Gilles, I've looked at the code for the new <discriminator> node for
> <resultMap>s and I can't get my head around it. I believe the idea came
> from the Hibernate people:
> 
> http://www.hibernate.org/hib_docs/reference/en/html/inheritance.html
> http://groups-beta.google.com/groups?q=Hibernate+discriminator
> 
> From reading those articles, is it correct to say that I use a
> discriminator to decide how sub-objects are populated?
> Is a <discriminator> used in conjunction with <subMap> nodes? This url:

Yes 

> http://tinyurl.com/c9vk8
> http://svn.apache.org/repos/asf/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Document.xml
> 
> has the following text:
> 
> <resultMap id="document" class="Document">
> <result property="Id" column="Document_ID"/>
> <result property="Title" column="Document_Title"/>
> <discriminator column="Document_Type"  />
> <subMap value="Book" resultMapping="book" />
> <subMap value="Newspaper" resultMapping="newspaper" />
> </resultMap>
> 
> Can I replace that with this:
> 
> <resultMap id="document" class="Document">
> <result property="Id" column="Document_ID"/>
> <result property="Title" column="Document_Title"/>
> <discriminator column="Document_Type"  />
> </resultMap>
> 
> Do I need to use <subMap> nodes when I use a <discriminator> node?

You need, have you watch the nunit test and the doc ? there is an
email on ibatis-dev named "Inheritance" (May 5) which contains the
last pdf doc

Reply via email to