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: Class which pulls data from more than one table.
PostPosted: Tue Oct 20, 2009 3:55 pm 
Newbie

Joined: Sat Sep 05, 2009 5:20 am
Posts: 2
Hi guys

I want to create a class which contains a couple of properties which will come from a different table.

So let's say I have a class Foo with properties as follows:

public string Badda {get;set;}
public string Bing {get;set;}
public string Toodle {get;set;}
public string Pip {get;set;}

Let's say that Badda and Bing directly match with columns in the underlying table Foo, but Toodle and Pip come from another related table, Bar.

The relationship between tables Foo and Bar is that Bar is a parent of Foo, so each Foo has one and only one Bar. (So Foo contains a BarId field).

I would like the Foo class to pull through the Toodle and Pip properties from the Bar table, but not be able to update them. How do I do this? Do I do in the the Foo mapping file?

Thanks for your help.

David


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.