Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate, mapping using discriminator - need idea

 
Krishnaa Kumar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Have a table(student) with columns stu_id, stu_name, favourite_subject, subject_id

favourite_subject will have predefined values like maths,english etc. if the value is maths, subject_id will have table: maths_subject's id.

meaning, based on favourite_subject value, subject_id will be pointing to the corresponding subject's id.

How can i implement in Hibernate ORM Framework.


all subjects will have their own tables & own corresponding entity classes.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the example for discriminator strategy provided for Hibernate here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic