Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

creating a database from a data model

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to annotate my classes using Hibernate. Suppose you have a UML diagram were you have a Person as a superclass, and a Member who is a child class of Person. Then you have Member who can be composed of many EmergencyContacts:


EmergencyContact *----1<> Member ----> Person

The Member will have an attribute of type List<EmergencyContact>. The EmergencyContact will have a foreign key called Member_Id that points to an Id in Member. I'm going to annotate the inheritance relationship between Person with @MappedSuperclass and Person with @Entity. How would you annotate EmergencyContact? Is there a best way to design a database with a composite relationship like this, or is the choice debatable? Should I create another table by labeling EmergencyContact with @Entity?
 
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic