Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mapping single class to multiple tables

 
mo sayed
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm interested to find out whether it's possible to map a single class to multiple tables using Hibernate.

e.g. mapping Employee.java to multiple tables such as PERSON [holds details such as name, employee id, etc] and CONTACT_DETAILS [holds info such as address, telephone number etc]

Looking through the reference hibernate documentation, I've come across the entity-name attribute, but am not sure how this fits in.

It's not possible to combine the tables into a single table and thereby exploit the 'component' feature, since this is the schema that's been dictated to us.

Thanks in advance,

regards,

Mo
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the <join> mapping element.
 
mo sayed
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Edvins,
Thanks for that.
Mo
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic