-->
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: Saving parent when I have children IDs only
PostPosted: Mon Mar 16, 2009 11:53 am 
Newbie

Joined: Thu May 04, 2006 2:42 pm
Posts: 10
Location: Columbus, OH
Let's say that I have classes like this:

Code:
public class Parent
{
   public int ParentId {get;set;}
   public IList<Child> Children {get;set;}
   public string Name {get;set;}
}

public class Child
{
   public int ChildId {get;set;}
}


Someone calls a method to save a new Parent and passes me a name and a list of Child IDs, and I want to save the Parent. Is there a way that I can save the Parent and associate the Child IDs to it without loading up the Child objects and then adding them to the Children collection? It seems like a waste to load up objects just so that I can get NHibernate to save them when I already have the IDs, which would be all I would need to save the Parent if I did it in a stored procedure.

using...
NHibernate 2.0.1GA
SQL Server 2005

Jon

_________________
Jon Kruger
http://jonkruger.com/blog


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.