-->
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 to remove the last child from collection.
PostPosted: Sun Oct 31, 2004 9:28 pm 
Newbie

Joined: Sun Oct 31, 2004 12:25 pm
Posts: 2
Hibernate version:2.1.6

Mapping documents:
<many-to-one
name="productFamily"
class="com.uss.cm4wless.domain.ProductFamily"
not-null="true"
>
<column name="family_ID" />
</many-to-one>


<set
name="products"
lazy="true"
inverse="true"
>
<key>
<column name="family_ID" />
</key>
<one-to-many
class="com.uss.cm4wless.domain.Product"
/>
</set>



Code between sessionFactory.openSession() and session.close():
tx = session.beginTransaction();
Product product = (Product) session.load(Product.class, productId);
ProductFamily family = product.getProductFamily();
Set products = family.getProducts();

products.remove(product);
session.delete(product);

session.flush();
tx.commit();



Full stack trace of any exception that occurs: no

Name and version of the database you are using:
mysql 3.23.58


The generated SQL (show_sql=true):
Hibernate: delete from cm4wless_mobile_product where product_ID=?


Debug level Hibernate log excerpt:

everything is OK if collection contain more than one child. problem is occured when only one child is left in collection. the last child is deleted in
database, but it still show in collection later.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 01, 2004 4:09 am 
Newbie

Joined: Sun Oct 31, 2004 12:25 pm
Posts: 2
found the probleml


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.