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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:49:41+00:00 2026-05-27T08:49:41+00:00

I have a M:N relationship between table Users and Groups . Now I am

  • 0

I have a M:N relationship between table Users and Groups. Now I am trying to join those two tables using JPA and I always get this exception:

Multiple writable mappings exist for the field [GROUPS.name]. Only one may be defined as writable, all others must be specified read-only.

Here is my Users class (I didn’t enclose getters and setters for brevity), it’s implemented by Admin class and SignedUser class with some additional properties.

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class Users implements Serializable {

    @Id
    @Column(name = "login", nullable = false, length = 10)
    private String login;

    @Column(name = "name", nullable = false, length = 30)
    private String name;

    @Column(name = "surname", nullable = false, length = 50)
    private String surname;

    @Column(name = "email", nullable = false, length = 100)
    private String email;

    @Column(name = "password", nullable = false, length = 20)
    private String password;

    @ManyToMany(mappedBy="users")
    private List<Groups> groups;

and this is the Group class:

@Entity
public class Groups implements Serializable {

    @Id
    @Column(name = "name", nullable = false, length = 20)
    private String groupName;

    @Column(name = "name", nullable = false, length = 50)
    private String descr;

    @ManyToMany
    @JoinTable(name = "user_group",
               joinColumns = {@JoinColumn(name = "groupName")},
               inverseJoinColumns = {@JoinColumn(name = "login")})
    private List<Users> users;

I’ve also tried to put JoinTable annotation into Users class but it ended with the same result. Thanks in advance for any advices.

  • 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-27T08:49:42+00:00Added an answer on May 27, 2026 at 8:49 am

    In the class Group you have two mappings for column name as properties groupName and descr.

    The error is not related to the ManyToMany.

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

Sidebar

Related Questions

I have a one to many relationship between two tables. The many table contains
I have a many to many relationship between users and groups: CREATE TABLE IF
i have 4 tables: questions, answers, users, and inquiries (relationship-table between all of them)
I have a relationship between two tables, authors and styles. Every author is associated
I have a many-to-many relationship between two tables, let's say Friends and Foods. If
I have two tables. Club and Coach. Between them is 0,1 - 0,1 relationship
I have a Users table and a Networks table with a many-to-many relationship between
I have a table Admins, which creates a relationship between Users and Locations: ID
I have two tables, users and groups . A user can belong to many
I have a relationship between two tables. The two tables PKs are int types.

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.