[jboss-user] [EJB 3.0] - Using own Classes as member for ManyToMany-Assotiations
micho
do-not-reply at jboss.com
Tue Feb 6 09:19:46 EST 2007
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
More information about the jboss-user
mailing list