-->
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: OneToMany assocation with Cascade.ALL, delete not applied
PostPosted: Thu Jan 22, 2009 9:40 am 
Newbie

Joined: Wed Apr 23, 2008 11:11 pm
Posts: 19
I have a simple one to many association between an Item class and a ItemProperty class. I have added CASCADE.ALL on the association and everything is running fine.

We also have a remote API to this service using Hessian. We have an advice that translates the Entity to a Dto and the ohter way around. We thus have an ItemDto on the client with a list of ItemPropertyDto.

The cascade is working fine as well except for the delete. If I have 3 item property instance and I remove one of them, I can see that the ItemPropertyDto is transformed to a list of ItemPropertyEntity. This list on the server has 2 items (the items remaining) but when I flush the session, no delete SQL order is generated. If I read the object again (be it in remote or in local) the deleted property is still there of course.

I am using ehcache as 2nd level cache.

How can I make sure that the list coming from the remote client is merged with the the actual hibernate list?

Thanks,
Stéphane


Top
 Profile  
 
 Post subject: DELETE_ORPHAN
PostPosted: Thu Jan 22, 2009 2:27 pm 
Newbie

Joined: Thu Jan 22, 2009 2:24 pm
Posts: 2
Have you tried org.hibernate.annotations.CascadeType.DELETE_ORPHAN? DELETE_ORPHAN is not included in cascade type ALL.


Top
 Profile  
 
 Post subject: Re: DELETE_ORPHAN
PostPosted: Sun Jan 25, 2009 10:55 am 
Newbie

Joined: Wed Apr 23, 2008 11:11 pm
Posts: 19
hontvari wrote:
Have you tried org.hibernate.annotations.CascadeType.DELETE_ORPHAN? DELETE_ORPHAN is not included in cascade type ALL.


I know. It's there. it *does* work with Hibernate (local API). It does not work with our detached object (remoite) API. I am sure there's something missing in our integration. Just wondering what I need to take care of to make it work with detached objects

Note that if the collection is in the 2nd level cache, it works. It doesn't if I disable the cache.

S.


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.