[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Laizy load the Collection

wilfried.deguil do-not-reply at jboss.com
Thu Jun 12 10:56:55 EDT 2008


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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157707#4157707

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157707



More information about the jboss-user mailing list