Forums Register Login

inheritance mapping

+Pie Number of slices to send: Send
i have a inheritance hierarchy like this

Employee
|
|__Assessee
|
|__Appraiser
|
|__Reviewer

and there is one table Employee representing all the information.
when i am trying to map Employee.hbm its saying that no discriminator
found for Assessee (single table per class). I am not sure whether to put a dcriminator column(Employee_Type) in database because the type might change at runtime. Is there a other way to do it without discriminator.

Thanks
+Pie Number of slices to send: Send
Tell me if I have this correct.

In the database you have only one table to store all the employee data of all three types.

So in that table, if I look at a row, how do I know which type of employee that row is? That is what hibernate needs to know in order to accurately create instance of the three subtypes. If it isn't there and you are using that inheritence strategy then there is going to be a problem.

You also mention something about runtime changing of types. So youa re saying that if you create an Appraiser object, later in runtime that object type will change to be a Reviewer object?

Mark
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 707 times.
Similar Threads
Hibernate: table per class inheritance
JPA Inheritance
InheritanceType.JOINED and DiscriminatorColumn
Problem in Joined Inheritance Strategy, getting null value in parent Discriminator column
How to delete all records in a JPA table?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 15:18:01.