-->
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: how to update the child Set in one-to-many relationship
PostPosted: Tue May 31, 2005 6:21 am 
Beginner
Beginner

Joined: Mon Sep 27, 2004 3:48 am
Posts: 23
My environment is WebWork 2.1.7 + hibernate 3.0.2

A page will show the parent properties and its childs, user also can delete/add child(s), when use clicking the 'Save' button, in WW action, I will get a new childs Set including some old childs and some new childs,
so if I want update the Parent and Childs, how to do it?

In the mapping file, I have set the @hibernate.set lazy="true" inverse="true" cascade="all-delete-orphan".

In the following way, I got a error message: Don't dereference a collection with cascade="all-delete-orphan":
Parent parent = session.get(Parent.class, parentID);
parent.setChild(newChildSet);
parent.saveOrUpdate(parent);

So, could anyone contribute a simple solution?[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 31, 2005 7:30 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi

Can you tell me the relationship you are using between each other?

Try this in your mapping file

In the mapping file, I have set the @hibernate.set lazy="true" inverse="true" cascade="all".

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


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.