I found the "Inheritance" thread from May 5:

http://tinyurl.com/9nn7a
http://www.mail-archive.com/ibatis-dev%40incubator.apache.org/msg00961.html

I saw Clinton's comment "The .NET version of iBATIS supports the
<subclass> element, but currently the Java version does not." but he
didn't expand on what the <subclass> element is or what it does.

I also saw your comment to the dataMapperGuide file on May 5th: 

 "- Updated doc for Inheritance and setting validateSqlMap" 

from this page:

http://tinyurl.com/7zbme
http://svn.apache.org/viewcvs.cgi/incubator/ibatis/trunk/cs/docs/dataMapperGuide/src/en/dotnet.xml?rev=168385&view=log

But the diff:

http://tinyurl.com/c2tef
http://svn.apache.org/viewcvs.cgi/incubator/ibatis/trunk/cs/docs/dataMapperGuide/src/en/dotnet.xml?rev=168385&r1=152334&r2=168385&diff_format=h

seems to only talk about validateSqlMap.

I understand these test cases:

http://tinyurl.com/b3h8y
http://svn.apache.org/viewcvs.cgi/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/InheritanceTest.cs?rev=156095&view=markup

Assert.AreEqual(6, list.Count);
Book book = (Book) list[0];
AssertBook(book, 1, "The World of Null-A", 55);
book = (Book) list[1];
AssertBook(book, 3, "Lord of the Rings", 3587);
Newspaper news = (Newspaper) list[2];
AssertNewspaper(news, 5, "Le Monde", "Paris");

What I'm having a hard time with now is understanding how you can write
a sql statement that handles several subclasses for document (i.e.
Book, Newspaper, Magazine). I'm imagining a single sql statement
joining a lot of tables and having many many columns.

There's a good possibility that the whole concept is very simple and
I'm just thinking about it to much.

Maybe someone can offer up another example besides documents,
newspapers, etc. A link to a Hibernate FAQ or thread would be helpful
too.

Thanks,
Ron

--- Gilles Bayon <[EMAIL PROTECTED]> wrote:
> 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