Hi
I have a problem with JPA (EclipseLink). I am not able to delete a association table. This is the situation:
- Product 1:n to ProductResource
- Resource 1:n to ProductResource
I first set the product and resource attributes of ProductResource. If I then try to delete the ProductResource object nothing happens (no sql is generated - no exception). If I comment out both OneToMany annotations in ProductResource I can delete the object. I can also delete the object when product and resource attributes are not set. If I comment out only the annotation above the ressource attribut the ProductResource object gets deleted upon the deletion of the product object (cascade=CascadeType.ALL). I hope someone could give me a hint. Thank you.
Product Resource:
public class ProductResource implements Serializable {
@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
private Product product;
@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.MERGE)
private Resource resource;
Product:
public class Product implements Serializable {
@OneToMany(mappedBy="product", fetch=FetchType.EAGER, cascade=CascadeType.ALL)
private List<ProductResource> productResources = new ArrayList<ProductResource>();
Resource:
public class Resource implements Serializable {
@OneToMany(mappedBy="resource", fetch=FetchType.EAGER, cascade=CascadeType.ALL)
private List<ProductResource> productResources = new ArrayList<ProductResource>();
Greetings Marcel