-->
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.  [ 3 posts ] 
Author Message
 Post subject: 1 class , multiple tables
PostPosted: Fri Aug 05, 2005 10:52 am 
Newbie

Joined: Fri Aug 05, 2005 10:48 am
Posts: 1
Dear community,

I'm a newbie concerning NHibernate and i was wondering if it is possible to map multiple tables with one OO class.
For example if a Object has to much properties to put into 1 table.

If so, does anyone have an idea to implement this ?

Thx in advance !


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 2:59 pm 
Beginner
Beginner

Joined: Wed Jun 29, 2005 10:40 am
Posts: 30
Location: denver, co
You could create a hierarchy of classes for each table, and use <joined-subclass> mappings so you can hydrate a single object from many different tables.

Example:

Class "PersonBase" maps to the "PersonBase" table.
Class "Person" extends "PersonBase" and maps (via a <joined-subclass>) to the "ExtendedPerson" table.

Now you can query from PersonBase and get your basic information, or you could query from Person and get the info that spans both tables.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 13, 2005 9:57 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
You can also create many classes (one for each table) and link them with a one-to-one :wink:

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


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