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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:47:49+00:00 2026-05-16T10:47:49+00:00

I m able to get values using JPA when i have only mapped one

  • 0

I m able to get values using JPA when i have only mapped one table

Now when i have gone for mapping related tables i get the error

  Only one may be defined as writable, all others must be specified read-only.
  Mapping: org.eclipse.persistence.mappings.OneToOneMapping[userId1]

I m using [EclipseLink-0] (Eclipse Persistence Services – 2.0.1.v20100213-r6600)

In one of the child tables i have this code

@OneToMany(cascade = CascadeType.ALL, mappedBy = "albumId")
private Collection<Images> imagesCollection;
@JoinColumn(name = "user_id", referencedColumnName = "User_ID")
@ManyToOne(optional = false)
private Roleuser userId;
@JoinColumn(name = "album_image", referencedColumnName = "image_id")
@ManyToOne
private Images albumImage;
@JoinColumn(name = "album_image", referencedColumnName = "image_id")
@ManyToOne
private Images albumImage1;
@JoinColumn(name = "user_id", referencedColumnName = "User_ID")
@ManyToOne(optional = false)
private Roleuser userId1;

What changes i have to do in this code to make the fields read-only?

or are there any better workaround for not making these fields read only?

  • 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-16T10:47:49+00:00Added an answer on May 16, 2026 at 10:47 am

    You have two ManyToOne relationships using the same foreign key field. This does not make sense, they will be the same object?

    @JoinColumn(name = "album_image", referencedColumnName = "image_id")
    @ManyToOne
    private Images albumImage;
    @JoinColumn(name = "album_image", referencedColumnName = "image_id")
    @ManyToOne
    private Images albumImage1;
    

    You should have two different foreign key fields, i.e. albumImage and albumImage1.

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

Sidebar

Related Questions

I'm trying to dynamically update a table of values using SocketStream. I have a
I want to be able to get different array values in my ajax callback
I am able to get the output of a pdf using fpdf, the problem
I'm finally able to get an Access Token, now I'm very confused as how
I am using SimpleINI to get values into std::stringstream my_string; - CSimpleIniCaseA::TNamesDepend::const_iterator i; for
am new to JPA and am able to get it quickly, I had been
I'm using my sql to get unique values from database My query looks as
I'm using highcharts to generate a chart from a table of values in the
I have an app using Spring, JPA (Hibernate) and the Java validation framework (Hibernate
Question I'm writing some code that needs to be able to get the values

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.