GeeCON Prague 2014*
The moose likes Object Relational Mapping and the fly likes Question on Association mappings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Question on Association mappings" Watch "Question on Association mappings" New topic
Author

Question on Association mappings

randy pausch
Greenhorn

Joined: Jun 26, 2008
Posts: 6
Hi,

Iam reading this book "Java persistence with Hibernate" and trying to summarize my understanding of Hibernate association mappings.So,to my knowledge, these are the questions I would ask when writing the mapping files.

1)Is the attempt, to map one & many valued relationships between Entity classes or between Value type classes?
2)Does the class being mapped, contain a collection
3)If it does, is the collection,

-- a)A collection of value-typed instances (either JDK type or custom value types) or references to value type.
OR
b)A collection of Entity references


What other questions would I have to answer before I can proceed to write the mapping file?

Thanks
Hibernate-Newbie

[ June 26, 2008: Message edited by: randy pausch ]

[ June 26, 2008: Message edited by: randy pausch ]
[ June 26, 2008: Message edited by: randy pausch ]
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Really, your mapping files should be a very natural elution from your object model.

So, does your object model have natural associations? Is one object associated with another. Can one object contain many instances of another object? Are the relationships uni or bi-directional?

These types of answers should come right out of the object model, or domain model that your are designing. From there, it's just a matter of mapping those natural, object oriented relationships to your database structure.

-Cameron McKenzie
randy pausch
Greenhorn

Joined: Jun 26, 2008
Posts: 6
Thanks McKenzie...

Now I see why a good understanding of UML is crucial.

This is why, I love the ranch. There's always someone who
helps.
 
GeeCON Prague 2014
 
subject: Question on Association mappings