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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:29:20+00:00 2026-05-11T14:29:20+00:00

I have a pretty simple JPA @ManyToMany relationship set up in my application. A

  • 0

I have a pretty simple JPA @ManyToMany relationship set up in my application. A Product is a part of one or more OrderSystems. Each OrderSystem can have many Products. It’s a typical many-to-many relationship.

The problem I’m fighting with is this: If I use orderSystems.remove() to remove a reference from a Product to an OrderSystem, the entry appears to be removed (within that session). However, the entry isn’t removed from the cross-reference table on flush, and when I reload the Product it has the previous set of OrderSystems.

I have the following code:

@Entity @Table(name = 'p_product_versions') @Validation public class Product {     private List<OrderSystem> orderSystems;     @ManyToMany     @JoinTable(name = 'p_order_systems_has_product_versions',              joinColumns =                 @JoinColumn(name = 'p_product_versions_prod_version_id'),             inverseJoinColumns =                 @JoinColumn(name = 'p_order_systems_system_id'))     public List<OrderSystem> getOrderSystems() {         return orderSystems;     }  }  @Entity @Table(name = 'p_order_systems') @Validation public class OrderSystem {     private List<Product> products;     @ManyToMany (mappedBy = 'orderSystems')     public List<Product> getProducts() {         return products;     } } 

Can anyone point me at what I’m missing here?

  • 1 1 Answer
  • 2 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. 2026-05-11T14:29:21+00:00Added an answer on May 11, 2026 at 2:29 pm

    Turned out that the problem was that I was not clearing the relationship in both directions. I would remove a Product from the OrderSystem but not remove the OrderSystem from the Product.

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

Sidebar

Related Questions

I have a pretty simple set up for a messaging application. I simply get
I have a pretty simple JSP/Servlet 3.0/Spring MVC 3.1 application. On one of my
I have a pretty simple winforms application. It contains a rich edit box, embedded
I have a pretty simple HABTM set of models class Tag < ActiveRecord::Base has_and_belongs_to_many
I have pretty simple application with text entry and button. When user press on
I have a pretty simple N:M relationship in SqlAlchemy 0.6.6. I have a class
I have implemented pretty simple application, using gwt and gwt event service 1.1.1, it
I have a pretty simple WPF application that is used to format inputs into
I have a pretty simple ASP.NET page with some input fields and validators. One
I have a pretty simple ASP.NET MVC Site Application. (MVC 1.0) I have NO

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.