File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


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: 3833

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