-->
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: maintaining relationships between mapped objects
PostPosted: Wed Jun 09, 2004 7:55 pm 
Beginner
Beginner

Joined: Wed Jun 09, 2004 2:49 pm
Posts: 25
As I undertand, I can maintain relationship between mapped javabeans
either by specifying the relationship the mapping XML,
or I can simply add my own code to the mapped javabeans to maintain relationships.

Which one is easier and mostly used in praactice?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 10, 2004 11:37 am 
Senior
Senior

Joined: Tue Sep 23, 2003 8:18 am
Posts: 137
Location: Johannesburg, South Africa
I believe that if you have the link in the relationship in your mapping XML, then you have to have the necessary structure in your objects.
e.g. a Bag relies on a collection of some kind (generally a List), wherehas, if you defined no link in the parent XML mapping, you could simply manually assign the Parent's PK as a FK within each of your child objects (also in the mapping as a normal element) as opposed to having to create a one-to-many link in the child.

I think Hibernate's true ORM power comes from getting those Bag's and one-to-many and many-to-many working properly. The ability to simply say session.save(xyz) and almost nothing more, is really nice. :)

Rather than having to do a whole loop and manually assign FK's, etc.

-G


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.