1 Reply Latest reply on Nov 10, 2005 7:34 AM by David Crick

    MBean accessing EJB 3 entity bean with ManyToMany relation

    David Crick Newbie

      We have an MBean that is accessing an EJB 3 entity bean through a DAO session bean. The entity bean has a collection member in a ManyToMany relationship with another entity bean. In the MBean, we persist (add) the entity bean with the collection set, and then later in the MBean we change the entity bean (keeping the collection intact, unchanged) and merge (update) the entity bean. When the JDBC batch for the update is written to the database, it seems that the exisiting collection (from the add) represented in the association table is ignored and the collection is written again to the association table. This causes a primary key constraint violation. Any help with this issue would be greatly appreciated.