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 7128917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:11:18+00:00 2026-05-28T11:11:18+00:00

I suspect there’s no perfect solution to this problem so least worst solution are

  • 0

I suspect there’s no perfect solution to this problem so least worst solution are more than welcome.

I’m implementing a dashboard using PrimeFaces and I would like to persist the model backing it (using JPA2). I’ve written my own implementation of DashboardModel and DashboardColumn with the necessary annotations and other fields I need. The model is shown below:

@Entity
public class DashboardSettings implements DashboardModel, Serializable{

    @Id
    private long id;
    @OrderColumn( name="COLUMN_ORDER" )
    private List<DashboardColumn> columns;

    ...a few other fields...

    public DashboardSettings() {}

    @Override
    public void addColumn(DashboardColumn column) {
        this.columns.add(column);
    }

    @Override
    public List<DashboardColumn> getColumns() {
        return columns;
    }

    ...snip...
}

The problem is the columns field. I would like this field to be persisted into it’s own table but because DashboardColumn is an interface (and from a third party so can’t be changed) the field currently gets stored in a blob. If I change the type of the columns field to my own implementation (DashboardColumnSettings) which is marked with @Entity the addColumn method would cease to work correctly – it would have to do a type check and cast.

The type check and cast is not the end of the world as this code will only be consumed by our development team but it is a trip hazard. Is there any way to have the columns field persisted while at the same time leaving it as a DashboardColumn?

  • 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-28T11:11:18+00:00Added an answer on May 28, 2026 at 11:11 am

    You can try to use targetEntity attribute, though I’m note sure it would be better than explicit cast:

    @OrderColumn( name="COLUMN_ORDER" )
    @OneToMany(targetEntity = DashboardColumnSettings.class)
    private List<DashboardColumn> columns; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a shared library using gcc and suspect that there may be
I suspect that one of my applications eats more CPU cycles than I want
I suspect there's probably an easy answer to this I'm just not seeing, but
I suspect there is an easy answer for this question but I can't find
I suspect there must be a built-in way to do this, but my Google-fu
As i can perform asynchronous operations using delegates,i suspect there is a thin chance
This is the second time I've implemented something like this and I suspect there
There has to be a easy solution to this. I have been trying to
I am new to php, but suspect there is a simple solution that I
I suspect this applies to general ASP.Net too but I am not sure. If

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.