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: Updating the One Side
PostPosted: Mon Sep 28, 2009 2:38 pm 
Newbie

Joined: Mon Sep 28, 2009 11:29 am
Posts: 4
Hi,

I'm new to NHibernate and am I am working with a asp.net mvc web application.

I have a PhoneNumber object that has an object called PhoneType representing items like "Work", "Home", "Mobile" etc. The PhoneTypeId has an Id and Name property. I need to update the PhoneTypeId on the PhoneNumber when a change has been made from a UI dropdownlist.

I will automatically have access to the PhoneTypeId when the form posts, but not the Name. To update the PhoneTypeId I assume that I must do something like the following:

phone.PhoneType.PhoneTypeId = drodownlistvalue;

But what about the Name value? Do both the Id and Name values need to be updated to save the correct PhoneTypeId on the PhoneNumber? I'm concerned about the need to make another db call just to get the Name or the need to cache the PhoneTypes collection into the HTTP SESSION. An object with many similar relationships starts getting really inefficient. Let's say an AddressType, State/Region, and Country were all needed in dropdowns for an Address object. What is the recommended practice for NHibernate?

Thanks,
Mark


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.