-->
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: BUG? Exception: deleted entity passed to persist
PostPosted: Thu Sep 16, 2010 5:43 am 
Newbie

Joined: Wed Mar 10, 2010 10:14 am
Posts: 12
Hi,

I have a @OneToMany relationship Order->OrderItem with CascadeType.ALL. I use JPA EntityManager, implementation is Hibernate 3.3. When I manipulate the List of OrderItem, then it works fine when I call em.merge(order). However, when I just remove some OrderItem from the List by calling

em.remove(orderItem);
em.flush();

then I have got: javax.persistence.EntityNotFoundException: deleted entity passed to persist: [...OrderItem#<null>]
But in this situation, I do not call any other em.merge(), or em.persist(). I have found a workaround: I have to call

em.remove(orderItem);
order.getOrderItems().clear();
em.flush();

But I do not understand, why I should clear OrderItem List before flushing the EntitytManager. Is this a Hibernate bug?

Thanks
Andy


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.