users@glassfish.java.net

Re: Persistence problem

From: <glassfish_at_javadesktop.org>
Date: Sun, 22 Jul 2007 13:40:13 PDT

I have a related problem with my EJBs. I have a ProjectBean and a FactorBean entity bean which relate to eachother through a M:N relationship, which becomes a join table and is supposed to be hadled by an @ManyToMany annotation. The ProjectBean has a collection of FactorBean an viceversa. So when I edit (remove some and add some others) the FactorBean collection within the ProjectBean, the intermediate join table "PROJECT_FACTOR" should be updated accordingly. But it is not. I use a getter method to objatin the collection from the ProjectBean, then remove some and add some FactorBeans and then I use a set method to add the collection back to the owning ProjectBean. Then I use de "edit" method on the ProjectBeanFacadeLocal interface generated by the NetBeans IDE, which in turn calls it's implementation in a ProjectBeanFacade session bean, which in turn calls the "merge" method on the ProjectBean. The changes are not persisted to the join table in the database.
Does anyone know why this could be happening?
Thanks
[Message sent by forum member 'miguelangelxfm' (miguelangelxfm)]

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