Hello
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 ?
Agnieszka
here is a piece of my session bean:
@Stateful
@Name("newS")
@Scope(ScopeType.SESSION)
@Restrict("#{identity.loggedIn}")
public class NewServiceAction implements NewService {
@PersistenceContext
private EntityManager em;
@Out(required=false)
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
cbService.getCbShortCodes().add(selectedCbShortCode);
em.persist(cbService);
}
//data for shortcode selection form on xhtml page
@Factory("fcbShCode")
public List<CbShortCode> getCbShortCode(){
cbShCode = em.createQuery("select s from CbShortCode s order by s.addr asc").getResultList();
return cbShCode;
}