-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: [FluentNHibernate] Multilevel inheritance mapping
PostPosted: Tue Dec 13, 2011 7:38 am 
Newbie

Joined: Mon Oct 24, 2011 10:04 am
Posts: 2
Hi,

I have multilevel inheritance: C extends B; B extends A, and wish to implement this using table-per-subclass.

I am working with Fluent NHibernate for my configuration and mappings but I have been unable to program the mapping for this example. The NHibernate mapping looks as follows and works properly:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true" assembly="RecipeGenerator" namespace="RecipeGenerator.Models.Objects">
  <class name="A" lazy="true">
    <id name="ID" />
    <property name="Name" />

    <joined-subclass name="B">
      <key column="ID"/>

      <property name="SomeProperty" />

      <joined-subclass name="C">
        <key column="ID"/>
        <property name="SomeOtherProperty" />
       
      </joined-subclass>

    </joined-subclass>
   
  </class>

</hibernate-mapping>


My idea was to use Subclass for B and C as follows (omitting their methods for the sake of explainability):

Code:
public class Amap : ClassMap<A>
{}

public class Bmap : SubclassMap<B>
{}

public class Cmap : SubclassMap<C>
{}


But when retrieving C objects from the database it gives the following error message:

"Duplicate class/entity mapping".

Any idea how I could remedy this?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.