Hello,
I'm using jBoss 4.2.2.GA and EJB3 with JPA.
I have this entity
public class Person {
private Collection geveRoles;
...
...
@ManyToMany(mapped="persons")
public Collection getGeveRoles() {
return geveRoles;
}
}
and another entity :
public class GeveRole {
private Collection persons
...
...
@ManyToMany
@JoinTable(name="EJB_GEVE_PERSONGEVEROLE" , joinColumns = @JoinColumn(name="personId",referencedColumnName="Id"),
inverseJoinColumn = @JoinColumn(name="geveRoleId",referencedColumnName="Id"))
public Collection getPerson() {
return persons;
}
}
So, when in my web application I invoke this :
RoleList = (List) person.getGeveRoles();
The jboss console displays :
failed to lazily initialize a collection of role: fr.horoquartz.core.entity.Person.geveRoles, no session or session was closed
Thanks in advance for your help
Please
You are trying to access the collection after your persistence context has been closed, or the entity is otherwise detached.
Can you post the class in which the exception is raised?