I would like to have a web page where a user can manage "groups" that he or she 
belongs to.  There are entity beans for users and groups, which have a 
@ManyToMany relationship (where I've set the user as the owning side).  The 
MessageManagerBean class in the examples seemed very similar to what I need, so 
I started with that and made a "groupManager" stateful session bean; the user 
is injected from having logged in and the @DataModel is a list of the groups 
that the user belongs to.  The user entity bean has a collection of groups and 
the group entity bean has a collection of users, with appropriate EJB3 
annotations.  When I try to bring up the group management page that references 
the group manager bean, I get:


  | org.hibernate.LazyInitializationException: failed to lazily initialize a 
collection of role: com.orgmob.member.User.groups, no session or session was 
closed
  | 

I looked at 
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=85894&start=0, which 
seems to suggest using eager fetching for this, but since there's a 
many-to-many relationship, I'd have the risk of pulling the entire user and 
group tables into memory, wouldn't I?

What's the right approach for this?  Thanks in advance and apologies if I've 
missed previously posted discussion or documentation or am misunderstanding 
eager fetching.

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959400
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to