File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Question on Association mappings

randy pausch

Joined: Jun 26, 2008
Posts: 6

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.
b)A collection of Entity references

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


[ 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

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

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
I agree. Here's the link:
subject: Question on Association mappings
It's not a secret anymore!