-->
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.  [ 2 posts ] 
Author Message
 Post subject: Mapping question: one2one vs component, and property
PostPosted: Mon Jan 17, 2005 12:40 am 
Newbie

Joined: Thu Jan 13, 2005 3:11 am
Posts: 11
i don't know how to choose a rite one among these three when i write my mapping file.

there are two classes correspondent to two tables. e.g. a user and a login detail. they are one to one relationship, at the same time, loginDetail could be a property or a component of user, what criterians should i consider when i make my decision.

cheers


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 17, 2005 2:52 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
It is better not have one to one relationships in database for very simple reasons, It needs join to select dependant entities and it needs to maintain integraty. You can avoid it by moving data to single table (the same is about herarchies) It is just optimization, phisical schema doe's not need to look nice, you can make it better with views. Databases can optimize disk usage if you declare nullable fields last, it is not a problem to have more fielts in single table.


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