-->
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: Problem mit one-to-one und delete
PostPosted: Mon Jul 02, 2007 6:24 am 
Newbie

Joined: Wed Dec 13, 2006 8:18 am
Posts: 3
Hallo,

ich habe in meinem mapping (vereinfacht) folgende Klassen:

Code:
<class name="com.mvb.uwdb.beans.orga.Employee" table="EMPLOYEE">
      <id name="id" column="ID" type="long">
         <generator class="native"></generator>
      </id>
      <one-to-one name="referenceSign" constrained="true" lazy="false" property-ref="employee" cascade="all"/>
</class>

<class name="com.mvb.uwdb.beans.orga.ReferenceSign" table="REFERENCESIGN">
      <meta attribute="dataTablespace">organisation</meta>   
      <meta attribute="indexTablespace">xorganisation</meta>   
      <meta attribute="protocol">yes</meta>
      <id name="id" column="ID" type="long">
         <generator class="native"></generator>
      </id>
      <property name="sign" column="SIGN" type="string" length="5" unique-key="uxREFERENCESIGN01" not-null="true"></property>
      <many-to-one name="employee" column="EMPLOYEE" class="com.mvb.uwdb.beans.orga.Employee" cascade="all" unique="true" unique-key="uxREFERENCESIGN02" foreign-key="fkEMPLOYEE01" not-null="true"></many-to-one>
      <property name="user" type="string" length="128">
         <column name="USER" default="USER" length="128" not-null="true"></column>
      </property>
      <property name="updated" type="calendar"  not-null="true" >
         <column name="UPDATED" default="CURRENT TIMESTAMP" ></column>
      </property>
   </class>


Wenn ich nun in den Beans aus einem employee das ReferenceSign lösche und diesen dann gegen die Datenbank per saveOrUpdate persistiere wird das ReferenceSign nicht gelöscht.

Wie kann ich das denn bewerkstelligen? Stehe leider gerade vollkommen auf dem Schlauch...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 09, 2007 2:28 pm 
Newbie

Joined: Mon Jul 02, 2007 2:12 pm
Posts: 18
Hi,

wenn ich Hibernate wäre, würde ich da auch nichts löschen. Du hast cascade von Employee nach ReferenceSign und auch von ReferenceSign nach Employee. Würde H. das Referencesign löschen, müsste es auch den Employee löschen. Nicht das was Du willst.

-Thomas


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.