This week's book giveaways are in the iOS and Features new in Java 8 forums.
We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line!
See this thread and this one for details.
The moose likes Object Relational Mapping and the fly likes hibernate, mapping using discriminator - need idea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "hibernate, mapping using discriminator - need idea" Watch "hibernate, mapping using discriminator - need idea" New topic
Author

hibernate, mapping using discriminator - need idea

Krishnaa Kumar
Greenhorn

Joined: May 05, 2011
Posts: 25
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

Joined: Mar 24, 2008
Posts: 3870

Look at the example for discriminator strategy provided for Hibernate here.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hibernate, mapping using discriminator - need idea