[jboss-user] [EJB 3.0] - Re: Hibernate3: Cannot simultaneously fetch multiple bags

andydale do-not-reply at jboss.com
Mon May 14 06:44:15 EDT 2007


Hi,

The "problem" comes from the following code:


  | private Collection<Role> roles = new ArrayList<Role>();
  | private Collection<Group> groups = new ArrayList<Group>();
  | 

A Collection is treated as a "bag".  You have have some possibilities to fix it.

An easy solution is to use the @CollectionID.  Another solution would be to change them to List<> and then use the @IndexColum, and the final solution is to change the to Set<>.  You must read up on Hibernate Collection mapping  first, to see whats suits your data model best.

Go to this URL:

http://www.hibernate.org/hib_docs/annotations/reference/en/html/entity.html#entity-mapping-association

Cheers,

Andy

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

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



More information about the jboss-user mailing list