Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on Association mappings

 
randy pausch
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic