I defined a class
public class UsergroupList extends ArrayList<Usergroup>
  | {}
  | 
The class user is
public class User implements Serializable
  | {  ...
  |   private UsergroupList mUsergroupList;
  |   
  |   @ManyToMany ( targetEntity = Usergroup.class )
  |   public Collection getUsergroupList()
  |   { return mUsergroupList; }
  
when deploying I get the error
org.hibernate.AnnotationException: Illegal attempt to map a non collection as a 
@OneToMany, @ManyToMany or @CollectionOfElements: com.xyz.UsergroupList
  | 
but I think   UsergroupList implements collection as it is an ArrayList
  
If I write 
@ManyToMany ( targetEntity = Usergroup.class )
  |   public Collection getBenutzerGruppeListe()
  |   { return mUsergroupList; }
  | the deployment works.

But invoking
private EntityManager em;
  | ...
  | erg = (List<User>) em.createQuery("from User").getResultList();
  | 
throws
javax.ejb.EJBException: javax.persistence.PersistenceException: 
org.hibernate.PropertyAccessException: Exception occurred inside setter of 
com.xyz.User.usergroupList
  | 



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

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

Reply via email to