-->
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: Automapping models by value of PK
PostPosted: Mon Sep 29, 2008 8:09 am 
Newbie

Joined: Mon Sep 29, 2008 7:58 am
Posts: 1
Hi all,
suppose I have the following

Code:
class Customer {
    public int Id { get; set; }
}

class Order {
    public int Id { get; set; }
    public int Customer { get; set; }
}


Now, given I know only of Customer's id value (e.g. CustomerId = 343) I'd like to instantiate an Order and have its Customer set to customer with that id. The important part here is I do not wish to do this explicitly (by loading Customer with session.Load<Customer>(id) and set the Customer property) instead, I'd like to provide Order with the value of CustomerId and have Nhibernate figure out CustomerId-Customer relationship and set Customer property for me.

Is it possible to do this?


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.