-->
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: Update error!
PostPosted: Wed Jun 29, 2005 4:06 am 
Newbie

Joined: Wed Jun 29, 2005 3:32 am
Posts: 2
happen error on update Tutor!
"You may not change the reference to a collection with cascade=\"all-delete-orphan\""

teacher.hbm.xml and tutor.hbm.xml

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" schema="dbo">
  <class name="UniversityEntity.Model.Person, UniversityEntity" table="Person">
    <id name="Id" type="Int32" column="PersonId"  access="nosetter.pascalcase-m-underscore" unsaved-value="0">
      <generator class="identity" />
    </id>
    <bag name="Resumes" inverse="true" cascade="all-delete-orphan">
      <key column="Person_PersonId" />
      <one-to-many class="UniversityEntity.Model.Resume, UniversityEntity" />
    </bag>
    <bag name="Relations" inverse="true" cascade="all-delete-orphan">
      <key column="Person_PersonId" />
      <one-to-many class="UniversityEntity.Model.Relation, UniversityEntity" />
    </bag>
    <property name="Birthday" column="Birthday" type="DateTime" />
    <property name="Clan" column="Clan" type="String" />
    <property name="EducationLevel" column="EducationLevel" type="String" />
    <property name="Folk" column="Folk" type="String" />
    <one-to-one name="Family" cascade="all" class="UniversityEntity.Model.Family, UniversityEntity" />
    <property name="Hearth" column="Hearth" type="String" />
    <property name="IsOverseasChinese" column="IsOverseasChinese" type="Boolean" />
    <property name="Name" column="Name" type="String" />
    <property name="NativePlace" column="NativePlace" type="String" />
    <property name="Oldname" column="Oldname" type="String" />
    <property name="Pic" column="Pic" type="BinaryBlob" length="4001" />
    <property name="Sex" column="Sex" type="String" />
    <property name="TopDegree" column="TopDegree" type="String" />
    <property name="Title" column="Title" type="String" />
    <one-to-one name="SocietySecurtyCard" cascade="all" class="UniversityEntity.Model.SocietySecurtyCard, UniversityEntity" />
    <property name="Password" column="Password" type="String" />
    <property name="LoginName" column="LoginName" type="String" />

   
    <!-- Begin 教师子类 -->
    <joined-subclass name="UniversityEntity.Model.Teacher,UniversityEntity" table="Teacher">
      <key column="TeacherId"/>   
      <property name="TeacherNo" column="TeacherNo" type="String" />       
      <bag name="StudentBases" inverse="true" cascade="none">
        <key column="PrimaryGuide_TeacherId" />
        <one-to-many class="UniversityEntity.Model.StudentBase, UniversityEntity" />
      </bag>
      <bag name="OtherStudentBases" table="StudentBase_Teacher" cascade="none">
        <key column="TeacherId" />
        <many-to-many column="StudentBaseId" class="UniversityEntity.Model.StudentBase, UniversityEntity" />
      </bag>
    </joined-subclass>
    <!-- End 教师子类 -->
   
    <!-- Begin 学生子类 -->
    <joined-subclass name="UniversityEntity.Model.StudentBase,UniversityEntity" table="StudentBase">
      <key column="StudentBaseId"/>
      <one-to-one name="TeachPlanForStudent"  class="UniversityEntity.Model.TeachPlanForStudent, UniversityEntity" />
      <many-to-one name="PrimaryGuide" column="PrimaryGuide_TeacherId" class="UniversityEntity.Model.Teacher, UniversityEntity"/>
      <bag name="OtherGuides" table="StudentBase_Teacher">
        <key column="StudentBaseId" />
        <many-to-many column="TeacherId" class="UniversityEntity.Model.Teacher, UniversityEntity" />
      </bag>
      <bag name="Graduates" inverse="true" cascade="all">
        <key column="StudentBase_StudentBaseId" />
        <one-to-many class="UniversityEntity.Model.Graduate, UniversityEntity" />
      </bag>
      <many-to-one name="DegreeGrade" column="DegreeGrade_DegreeGradeID" class="UniversityEntity.Model.DegreeGrade, UniversityEntity"/>
      <many-to-one name="ProfessionalDirector" column="ProfessionalDirector_Id" class="UniversityEntity.Model.ProfessionalDirector, UniversityEntity" />
      <property name="EntranceDate" column="EntranceDate" type="DateTime" />
      <property name="PartTimeHeadship" column="PartTimeHeadship" type="String" />
      <many-to-one name="WorkUnit" column="WorkUnit_WorkUnitId" class="UniversityEntity.Model.WorkUnit, UniversityEntity" cascade="all" />
      <property name="StudentNo" column="StudentNo" type="String" />   
      <many-to-one name="ClassInfo" column="ClassInfo_ClassInfoId" class="UniversityEntity.Model.ClassInfo, UniversityEntity"/>
    </joined-subclass>
    <!-- End 学生子类 -->

  </class>
</hibernate-mapping>


Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" schema="dbo">
  <class name="UniversityEntity.Model.Tutor, UniversityEntity" table="Tutor">
    <id name="Id" type="Int32" column="TutorId" access="nosetter.pascalcase-m-underscore" unsaved-value="0">
      <generator class="foreign">         
         <param name="property">Teacher</param>
      </generator>
    </id>
    <property name="FirstMasterTutorDate" column="FirstMasterTutorDate" type="DateTime"/>
    <property name="FirstDoctorTutorDate" column="FirstDoctorTutorDate" type="DateTime" />
    <property name="IsStarted" column="IsStarted" type="Boolean" />
    <property name="IsProhibited" column="IsProhibited" type="Boolean" />
    <property name="Reason" column="Reason" type="String" />
    <bag name="ProfessionalDirectores"  cascade="none" table="Tutor_ProfessionalDirector">
     <key column="Tutor_TutorId" />
     <many-to-many class="UniversityEntity.Model.ProfessionalDirector, UniversityEntity" column ="ProfessionalDirector_ProfessionalDirectorId"/>
   </bag>
    <many-to-one name="TutorType" column="TutorType_TutorTypeId" class="UniversityEntity.Model.TutorType, UniversityEntity" unique="true"/>
    <many-to-one name="University" column="University_UniversityId" class="UniversityEntity.Model.University, UniversityEntity" unique="true"/>
    <many-to-one name="Institute" column="Institute_InstituteId" class="UniversityEntity.Model.Institute, UniversityEntity" unique="true"/>
    <many-to-one name="ResearchIntroduce" column="FormatedText_FormatedTextId" class="UniversityEntity.Model.FormatedText, UniversityEntity" unique="true"/>
    <one-to-one name="Teacher" class="UniversityEntity.Model.Teacher,UniversityEntity" constrained="true" />
  </class>
</hibernate-mapping>
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 10:11 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Can you send the code with the operations you are doing ? (your "main()" method)

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


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.