Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8537741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:58:21+00:00 2026-06-11T10:58:21+00:00

I have 3 tables represented by JPA model. First one: @Entity @Table(name = DECISION)

  • 0

I have 3 tables represented by JPA model.

First one:

@Entity
@Table(name = "DECISION")
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class Decision {
    @Id
    private Long id;
}

Next class extends Decision:

@Entity
@Table(name = "SPECIFIC_DECISION")
public class SpecificDecision extends Decision {
    @OneToOne
    @JoinColumn(name = "PERSON_ID")
    private Person person;
}

The last one is Person and it’s just simple entity class with person info.

Now when I try to select all decisions from database I get an error with information that the persistence unit is inconsistent with the database schema, because column DECISION.PERSON_ID does not exist, while I do have it in SPECIFIC_DECISION table and that’s how I mapped it in JPA model.

What’s more interesting if there’s no relations in SpecificDecision, only simple NUMBER and VARCHAR fields then everything works fine.

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:58:22+00:00Added an answer on June 11, 2026 at 10:58 am

    Looks like there’s a solution to my problem. JPA looks for joined columns in base table by default. To change this behaviour an attribute “table” in JoinColumn annotation is needed:

    @Entity
    @Table(name = "SPECIFIC_DECISION")
    public class SpecificDecision extends Decision {
        @OneToOne
        @JoinColumn(table = "SPECIFIC_DECISION", name = "PERSON_ID")
        private Person person;
    }
    

    Problem solved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables: t_promo_program and t_promo_program_param. They are represented by the following JPA
I have the following tables represented in my Entity Framework diagram (.edmx file) Users
I have two tables table COMMUNITY id, name, etc. table PROPERTY id, community_id, type,
I have two tables in my database schema that represent an entity having a
I have 20+ tables similar to table 1. Where all letters represent actual values.
I have a table with tax rates where NULL entity type rows represent the
Suppose I have two columns in a table that represents a graph, the first
In my Yii application, I have a model that represents siteconfig table and have
I have two tables with parent - child relationship: PARENT table with id as
Should this be represented in the database as 1 table or 3 tables? I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.