you should use extends and <join>

2009/3/19 graphicsxp <[email protected]>

>
> Hello,
>
> I have an exception Duplicate class/entity mapping Comp.PostBase.
>
> This is because I have two mapping files for two different tables but
> they both map to two classes that share the same base class :
>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
>  <class name="Comp.PostBase, Comp" table="Comment" lazy="true"
> discriminator-value="POST_BASE" abstract="true">
>    <id name="Id" column="PostID">
>      <generator class="native"/>
>    </id>
>
>    <discriminator column="Type" type="string" />
>
>    <property name="DateCreated" type="date" column="DateCreated" />
>
>    <subclass name="Comp.CommentPost, Comp" discriminator-
> value="COMMENT">
>      <property name="ParentId" type="Comp.CommentPost, Comp"
> column="ParentId" />
>      <many-to-one name="thePost" cascade="none" column="PostID" not-
> null="true" />
>    </subclass>
>
>  </class>
> </hibernate-mapping>
>
>
> AND
>
>
>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
>  <class name="Comp.PostBase, Comp" table="Post" lazy="true"
> discriminator-value="POST_BASE" abstract="true">
>    <id name="Id" column="PostID">
>      <generator class="native"/>
>    </id>
>
>    <discriminator column="Type" type="string" />
>
>    <property name="DateCreated" type="date" column="DateCreated" />
>
>    <!-- Description of a Post entity -->
>    <subclass name="Comp.Post, Comp" discriminator-value="POST">
>      <property name="Headline" type="string" length="500"
> column="Headline" />
>      <property name="URL" type="string" length="1000" column="URL" />
>      <property name="AnalystComment" type="string"
> column="AnalystComment" />
>      <bag  name="Comments" inverse="true" cascade="all" lazy="true">
>        <key column="CommentID" />
>        <one-to-many class="Comp.CommentPost, Comp" />
>      </bag>
>    </subclass>
>
>  </class>
> </hibernate-mapping>
>
>
> That seems to be a big issue for me. How can I do that ?
> >
>


-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to