-->
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: One-to-many : org.hibernate.StaleStateException: Batch updat
PostPosted: Wed Mar 29, 2006 9:29 am 
Newbie

Joined: Wed Mar 29, 2006 9:21 am
Posts: 1
Hallo,

folgende Situation:


Code:
class Parent {
    private Set childs;
}

<hibernate-mapping>
<class name="Parent" table="PARENT">
   <id name="uuid" type="string" unsaved-value="null">
      <column name="parentUid" length="64" not-null="true" />
         <generator class="assigned" />
   </id>      

        <set name="childs" inverse="true" cascade="all">
      <key column="parentUid" />
      <one-to-many
         not-found="ignore"
         class="Child" />
      </set>
   </class>
</hibernate-mapping>

class Child {
   private Parent parent;
}

<hibernate-mapping>
<class name="Child" table="CHILD">
   <id name="uuid" type="string">
      <column name="assignmentUid" length="64" not-null="true" />
      <generator class="assigned" />
   </id>
      
   <many-to-one name="parent" class="Parent" column="parentUid" not-null="true" />
</class>
</hibernate-mapping>



Funktioniert nur, wenn unsaved-value="null" beim Mapping der Child id nicht gesetzt wird. Ansonsten:

org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1

bei folgendem Code :

Parent ist schon persistiert und wurde geladen.
Code:
Child = new Child();
parent.add(child);
session.save(parent);


Warum bekommt man die Exception ? Was bedeutet die Exception ?

Danke, Dirk.
Code:


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.