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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:31:42+00:00 2026-06-04T21:31:42+00:00

I have two tables, Users and Products. And im trying to automatically create a

  • 0

I have two tables, Users and Products. And im trying to automatically create a new Table TestedProducts, which is a many to many relationship between User and Product. However, i get this error.

org.apache.jasper.JasperException: javax.ejb.EJBException: The bean encountered a non-application exception; nested exception is: 
<openjpa-1.2.1-r752877:753278 fatal user error> org.apache.openjpa.persistence.ArgumentException: 
"ejb.UserEntity.products<element:interface ejb.Product>" has columns with targets, but OpenJPA does not support any joins on this mapping in this context.

The UserEntity looks lite this.

long id;

String firstname;
String lastname;
String password;
String email;
String description;

List<Product> products;

public void setId(long id){
    this.id = id;
}

@Id
@GeneratedValue
public long getId() {
    return id;
}

@ManyToMany
@JoinTable(name="TestedProducts", 
joinColumns=
    @JoinColumn(name="usrId", referencedColumnName="id"),
  inverseJoinColumns=
  @JoinColumn(name="prodId", referencedColumnName="id")
  )
  public List<Product> getProducts() {
    return products;
  }

  public void setProducts(List<Product> products) {
    this.products = products;
  }

And ProductEntity like this:

long id;

String name;
String description;
String type;

List<User> users;

@ManyToMany(mappedBy="products") 
protected List<User> getUsers() {
    return users;
}

protected void setUsers(List<User> users) {
this.users = users;
}

I skipped the rest of the setters and getters.

  • 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-04T21:31:44+00:00Added an answer on June 4, 2026 at 9:31 pm

    You need to annotate the list containing users in the product entity the same way you did in the user entity, only inverted. I don’t think the mappedby value is handled the same.

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

Sidebar

Related Questions

I have Two tables. 1.Users table (Username , Name) 2.Picture table( ID , Username
I have two tables, Users and People, both of which share a common attribute,
I have a rails app, with two separate DB tables, users and products. A
I have two tables users and lead_contacts which have similar data. When somebody buys
I have two tables, one table is the items container, which holds all data
I have two tables: Users: ID, first_name, last_name Networks: user_id, friend_id, status I want
I have two tables- users and language with a foreign key link of their
hope someone can help. I have two tables: Users -UserID -UserName UsersType -UserTypeID -UserID
I am using EF4 with the EDM designer. I have two tables : Users
If I have two tables - Logins and Users, as follows: Logins LoginIdNo UserIdNo

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.