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.  [ 2 posts ] 
Author Message
 Post subject: Repated column in mapping for class exception
PostPosted: Fri Aug 11, 2006 3:03 am 
Newbie

Joined: Thu Aug 10, 2006 10:08 pm
Posts: 12
I am gettin this exception when trying to add a subclass into my exsisting class.

none of my C# classes actually contain a repwated property however my database dose store repeated information. This is because the project is adding onto an exsiting schema.

the

ID, Entry_Date and EFT_INFO_ID colums are repeted in both tables.

can anyone see what i have done wrong !!?.

Also have i got the concept of inheritance correct for nhibinate? If i have a class that inherits data from another, should they share a primary key.(ie the key is both a PK and a FK) ?

Ideally the ATD class should be adstract and only have instance of ATDImage and ATDwww (when i write it next). I am fairly new to nhibernate and these concepts havent been cemented yet.


Mapping documents:
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" namespace="ATDService" assembly="ATDService">
   <class name="ATD" table="ATD_PARENT" discriminator-value="NEVER">
      <id name="Id">
         <column name="Id" sql-type="int(4)" not-null="true" />
         <generator class="identity" />
      </id>
      <discriminator column="TYPE"/>
      <property name="EftInfoId">
         <column name="EFT_INFO_ID" sql-type="int(4)" not-null="true" />
      </property>
      <property name="Type">
         <column name="TYPE" sql-type="nvarchar(10)"  not-null="true" />
      </property>
      <property name="User">
         <column name="Entry_user" sql-type="nvarchar(50)" not-null="true" />
      </property>
      <property name="EntryDate">
         <column name="Entry_Date" sql-type="datetime" not-null="true" />
      </property>
      <subclass name="ATDImage" table="ATD_INFO" discriminator-value="IMG">
         <property name="Image">
            <column name="Atd_picture" sql-type="image" not-null="true" />
         </property>
      </subclass>
   </class>
</hibernate-mapping>


Full stack trace of any exception that occurs:

Code:
"Repated column in mapping for class ATDImage should be mapped with insert="false" update="false"


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 11, 2006 4:35 am 
Senior
Senior

Joined: Wed Jun 15, 2005 4:17 am
Posts: 156
you mapped the discriminator column TYPE again as property "Type". Thats the duplication. Remove the property Type.
To understand NHibernate implementation of inheritance read the docs thoroughly. Also there are some books about Hibernate published. Everything related to inheritance implementation applies to NHibernate as well.

cheers,
Radu


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

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.