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: Mapping one table into n classes with one-to-one relation.
PostPosted: Fri Feb 05, 2010 6:36 am 
Newbie

Joined: Fri Feb 05, 2010 4:59 am
Posts: 2
Hi,

that is my first post here and i thank you already for your help and for being patience with me ;-):

I would like to persist (XML) two (or more) classes with one-to-one relationship into one database table. I could not find any mapping-examples to do so.

Example:

Class1: Customer
Id
Firstname
Lastname
Birthday
...

Class2: Address
Id
City
Road

(Class3: xyz
Id
X1
X2
Y1
...)

DB Table
Id
Firstname
Lastname
Birthday
City
Road
X1
X2
Y1
...

This is not the best design, but the database already exists and i do not want to persist a 50 column table with only one class.


Top
 Profile  
 
 Post subject: Re: Mapping one table into n classes with one-to-one relation.
PostPosted: Fri Feb 05, 2010 7:22 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Normally you would use components for that and not relationships. Checkout the documentation:

http://nhforge.org/doc/nh/en/index.html#components

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re: Mapping one table into n classes with one-to-one relation.
PostPosted: Fri Mar 05, 2010 6:29 am 
Newbie

Joined: Fri Feb 05, 2010 4:59 am
Posts: 2
Simple, but very helpful. Thank you. Is there a function to benchmark other users, give them creditpoints or somthing else?


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.