Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within EJB and other Jakarta /Java EE Technologies
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
EJB and other Jakarta /Java EE Technologies
JPA Inheritance
Morten Franorge
Ranch Hand
Posts: 137
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I have a issue with implementing inheritance with a database design. The design is like this (somewhat simplified for readability)
PERSON
id INTEGER PK
name VARCHAR
type INTEGER FK (PERSON_TYPE.id)
PERSON_TYPE
id INTEGER PK
decode VARCHAR <--- This is the DISCRIMINATOR
created_by VARCHAR
created_at DATETIME
EMPLOYEE
id INTEGER
employee_no INTEGER
position VARCHAR
CUSTOMER
id INTEGER
customer_no INTEGER
vip CHAR
The relations is like this:
PERSON ---> PERSON_TYPE ---> EMPLOYEE/CUSTOMER
Is there anyway to solve this? The problem seems to be that the descriminator column is not in the parent class/table (person) but in a "codes table"
SCJP 1.4, SCBCD 1.3, SCBCD 5.0, SCEA J2EE, SCEA 5.0
Jon Wetherbee
author
Posts: 33
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
In your model, can you make PERSON a @MappedSuperclass instead of an @Entity? If so, you can have PERSON_TYPE be the root of the inheritance hierarchy, and it can be the entity that specifies the @DiscriminatorColumn.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
one-to-one mapping issue.
Foriegn key mapping
Need help on one-to-one - child data not getting saved
Hibernate: Can someone verify my mapping configuration?
multiple composit key
More...