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 Discriminator column not accessible Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Discriminator column not accessible" Watch "Discriminator column not accessible" New topic
Author

Discriminator column not accessible

RamandeepS Singh
Ranch Hand

Joined: Aug 25, 2009
Posts: 63
Hi Everyone

in @inheritance type Joined

I have class person, employee and Student

i have common columns in Person , and getters setters for discriminator column if i have to access it from person class



so when i am saving the Employee or Student record and then retrieving Person record, It is giving me discriminator column value as NULL
but after restarting the server its giving me value accordingly

if i manually set the value of discriminator column value and then save and retrieve then its giving me the value (Do i need to manaully set the discriminator column value?)
then what is benefit of using discriminator column

why should i not use OneToMany relation of person with employee and student having column Type and via enum i can enter the perspective value into the column
and i will also apply lazy fetching on that columns

Please Suggest

Thanks In Advance
Ramandeep Singh
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1646
    
    7

Please edit your post and UseCodeTags.


[How To Ask Questions][Read before you PM me]
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1646
    
    7

Do i need to manaully set the discriminator column value?


No. Not when you are using it properly.


The inheritance strategy you have chosen does not use a discriminator.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Discriminator column not accessible
 
Similar Threads
Single Table Inheritance Type
One-to-One mapping problem
JPA mapping with inheritance, elementcollection and many-to-many relationship
Problem Persisting Entity In Hibernate
Child and Parent Saving On Null and Not Null