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

  • SEARCH
  • Home
  • 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 4172432
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T00:33:45+00:00 2026-05-21T00:33:45+00:00

I have an existing DB schema which I’m trying to ORM’ise with JPA/Hibernate annotations.

  • 0

I have an existing DB schema which I’m trying to ORM’ise with JPA/Hibernate annotations. The schema is designed to
allow for clients to assoicate extra information with each row in a table. Rather than using a key-value pattern
the existing solution determines the required number of dynamic columns at install time, and alters the table to
add extra columns for the dynamic fields. In effect each table has a set of known/fixed columns and group of dynamic columns.

|table:X|
|id|known1|known2|dynamic1|dynamic2|..|dynamicx|

A parameter table indicates which tables have extra dynamic fields

|table:parameter|
|table|column|meta|
|x|dynamic1||
|x|dynamic2||
|x|dynamicx||
|y|dynamic15||

In JPA modelling this, it is easy to create a definition for the known fixed columns on each table.

@Entity
@Table(name="x")
public class X
{
    @Id
    private Long id = null;

    @Column(name="known1")
    private Long known1 = null;
}

I plan to model the parameter table as a class, and then allow each of my classes to have a list of parameters.
I’m unsure how i should go about mapping this List object so that the details are written to the same table.

@Entity
@Table(name="x")
public class X
{
    // @Column(name="x",class="X") ??????????
    List<Parameter> dynamicColumns = null;
}

I believe i can use a custom naming strategy to correctly determine the column name for the dynamic field. Is this
type of mapping even possible?

  • 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-05-21T00:33:46+00:00Added an answer on May 21, 2026 at 12:33 am

    I think you will need to use a nativeQuery to get at this dynamic data using jpa.

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

Sidebar

Related Questions

For whatever reason, I have a lot of clients that have existing data that's
I have an existing schema: class Example (db.Model) : row_num = db.IntegerProperty(required=True) updated =
I have an existing database with tables which each have 4 partitions (there are
TASK : I have an existing xml document (UTF-8) which uses xml namespaces and
We have an existing WCF service that makes use of wsDualHttpBinding to enable callbacks
I have an existing codebase targeting a Windows environment and with an eye to
I have an existing database with the table Transactions in it. I have added
I have an existing C++ project on a linux environment, and would like to
I have an existing website that uses the same code base, but is deployed
I have an existing library (JPhysX) that is a Java wrapper for a native

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.