-->
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: Update Delete of child record in one operation
PostPosted: Sat Jul 18, 2009 2:23 pm 
Newbie

Joined: Sat Jul 18, 2009 2:20 pm
Posts: 1
Hi,

I have an update address page, which gets loaded with address details
of logged in user. The user can have either same billing and shipping
address or different billing and shipping address.
Scenario one:
If the user had previously saved two addresses, (diff. billing and
shipping addresses) and he ticks the checkbox to say that his billing
and shipping address is the same.
Scenario two:
If the user had previously given one address as same for billing and
shipping and now adds a new billing address.

How would I tell nhibernate to delete the second address in scenario
one and update the changes in the first address
How would I code nhibernate to add a new address in scenario two?

Thanks for your help. I am new to nhibernate and this is a complex
situation.
Please let me know if you need to see the code.


Top
 Profile  
 
 Post subject: Re: Update Delete of child record in one operation
PostPosted: Mon Jul 20, 2009 5:40 pm 
Newbie

Joined: Mon Jul 20, 2009 5:25 pm
Posts: 4
This doesn't seem like an NHibernate problem. You need to set your User class up so that, you set the billing address to null in scenario 1 and add a new billing address in scenario 2. You then need to set your mapping file so that both the shipping and billing address relationships have a cascade="all" set on them.


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.