-->
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.  [ 5 posts ] 
Author Message
 Post subject: Mapping one class to multiple tables
PostPosted: Mon Jan 15, 2007 4:35 pm 
Newbie

Joined: Thu Aug 10, 2006 12:27 pm
Posts: 8
Hey guys,

is it possible with nhibernate (latest stable version) to map one domain class to multiple tables?

So if i have a class

classA
{
int identID;
string someProp;
string prop1;
string prop2;
string prop3;
}

I want to store this to four different tables. One would be for classA to store identID and someProp properties. The other three tables would be like this:

table1: identId, prop1; table2: identID, prop2; table3: identID, prop3;

How do you tell in the nhibernate mapping file that classA prop1, 2, and 3 come from a different table?

This is rather simplified as i have more than one property to store in each table. I need to do this because I cannot modify the existing data layout. Is there a way to do such a thing with nhibernate?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 10:15 pm 
Senior
Senior

Joined: Sat Mar 25, 2006 9:16 am
Posts: 150
No, you have to map it as a one-to-one with other classes.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 16, 2007 1:17 pm 
Newbie

Joined: Thu Aug 10, 2006 12:27 pm
Posts: 8
Thanks,

yeah, that's what it looked like from the docs. Just wanted to confirm I didn't miss it somewhere.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 16, 2007 2:23 pm 
Senior
Senior

Joined: Sat Mar 25, 2006 9:16 am
Posts: 150
It would be a nice feature, I have wanted to this myself. Maybe just add a "table" attribute to the component element.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 7:56 pm 
Newbie

Joined: Thu Aug 10, 2006 12:27 pm
Posts: 8
Yeah, that's is what I thought too. I just assumed that component had a table attribute and then the properties grouped within that component would be loaded from the specified table.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.