0 Replies Latest reply on Dec 12, 2008 10:09 AM by Agnieszka Kozak

    Many To Many - persisting entity problem?

    Agnieszka Kozak Newbie


      Welcome everybody.
      I am a new seam user and I really like it, but it is not easy to learn.

      Could You please
      Help me ? 

      with this:

      I have two entities  with relationship many-to-many, generated from existing database - Generate Seam Entities (I am using JBoss Developer Studio)
      and I could not persist it.
      I've been looking for solution for two days...

      Exception: javax.ejb.EJBTransactionRolledbackException: org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions

      How to make it persist ?


      here is a piece of my session bean:

      public class NewServiceAction implements NewService {
            private EntityManager em;
            private CbService cbService;
            private CbShortCode selectedCbShortCode;       
            private List<CbShortCode> cbShCode;
            public void createCbService(){
                   cbService = new CbService();                                                  
            public void process()
                //other cbService attributes set by form on xhtml page
              //data for shortcode selection form on xhtml page 
              public List<CbShortCode> getCbShortCode(){
                   cbShCode = em.createQuery("select s from CbShortCode s order by s.addr asc").getResultList();
                return cbShCode;