• 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: 3953
21
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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!