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.  [ 3 posts ] 
Author Message
 Post subject: Problem when deleting an object [Example from Hib reference]
PostPosted: Tue May 09, 2006 4:42 am 
Regular
Regular

Joined: Thu May 04, 2006 5:24 am
Posts: 55
I'm using an example from Hibernate reference:

<class name="Order" table="orders">
<id name="id">
<generator class="native"/>
</id>
<property name="date"/>
<many-to-one name="customer" column="customer_id"/>
<list name="lineItems" table="line_items">
<key column="order_id"/>
<list-index column="line_number"/>
<composite-element class="LineItem">
<property name="quantity"/>
<many-to-one name="product" column="product_id"/>
</composite-element>
</list>
</class>

And when I load Order from database, and try to delete it, I got
this error:

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

It seems like line item are deleted, but then Hibernate try to update
this Order, insted of deleting it ?!

Please help.


Top
 Profile  
 
 Post subject: Another thing...
PostPosted: Tue May 09, 2006 4:53 am 
Regular
Regular

Joined: Thu May 04, 2006 5:24 am
Posts: 55
Also, I'm getting this error here:

org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [org.hiberante.example.Order#2].

What is the problem ?!


Top
 Profile  
 
 Post subject: What is solution ?!
PostPosted: Tue May 09, 2006 2:37 pm 
Regular
Regular

Joined: Thu May 04, 2006 5:24 am
Posts: 55
O.K. I found solution for this second error (ObjectDeletedException), an Order must be deleted from collection which contains it when deleting.

But, I still getting this first error when I try to delete Order:

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

Order is has not been deleted ! What's the problem here ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.