Hello, I go stuck trying to make a ManyToMany cascading event to work. I've bean browsing through similar posts, but I can't see where my code is doing wrong.
I have two tables Organisation and Project, Organisation is the owner of the relationship and there is a relation table between the two.
I am trying to persist a new project entity, that can have one or more organisation associated to it. I use a selectManyListbox(
JSF 2) to let the user choose more than one organisation.
All this works fine until I try to cascade the relationship. Either only the project is getting persisted or the persistent manager creates new copies of the same project, for every organisation that is associated to it. I.e. different orgID and projID (instead of different orgID refering to the same projID)
Why does JPA makes new instance of the same Project (identical properties, except the ID) when I try to persist the relation ?
I am trying to learn JPA/JSF and any help is very welcomed. Greetings Chris.
PS. In the Project bean controller I got the right instances of Organisations that the user selects.
Entity objects
Project bean controller
Finally the Organiasation facade edit function