users@glassfish.java.net

Remove error in unidirectional ManyToMany relationship

From: <glassfish_at_javadesktop.org>
Date: Tue, 24 Feb 2009 04:00:55 PST

Dear all,
I have defined the following unidirectional ManyToManyrelationship

[i]@Entity
public class ProductFamily {
        
...

        private List<ProductItem> productItems;
        
...

        @ManyToMany
        @JoinTable(
                        name="productfamily_productitem",
                        joinColumns=_at_JoinColumn(name="productfamily_id"),
                        inverseJoinColumns=_at_JoinColumn(name="productitem_id"))
        public List<ProductItem> getProductItems() {
                return productItems;
        }

...

}
[/i]

When I try to remove one object of the owned side, correctly a DatabaseException is thrown:

Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: update or delete on "productitem" violates foreign key constraint "productitem_fkey" on "productfamily_productitem"

My question is: is it an implementation error in Glassfish or I didn't unterstand correctly the ManyToMany annotation (I mean: my expectation is that glassfish should remove fk in the jointable)?
[Message sent by forum member 'fbonsignori' (fbonsignori)]

http://forums.java.net/jive/thread.jspa?messageID=333521