• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

JPA inheritance and entity classes

Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am new to JPA and trying to do some testing and practice. I have a very specific scenario, I have two entities as below
Mapped to person class as single table

extends Person and fields specific to customer are stored in customer table however person related fields are stored in person class/table itself.

Now what I want is I don't want to describe a descriptor in person table as a person record in this table is complete itself to define a person however when i ask for a customer JPA should map person record in person table and fetch them in customer instance. As customer class extends person class it has all the fields.

What actually I want is a customer is anyway a person so by inheritance it gets all the fields of person. but because person is mapped to person table and it has all its persisting fields mapped to person table. When I try to load or save person object it tries to fetch dtype column (descriptor) but in actual when I try to fetch person i just need a person definition not its customer fields and a person can also be inherited by employee class or a normal person itself (no need to be customer or no need to be an employee).

Please help!
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

    Bookmark Topic Watch Topic
  • New Topic