I have two classes: User and UserGroup.
For them I need a bidirectional many-to-many relation.
The method getUsers() is in UserGroup class and getUserGroup() is in User class.
Code:
/**
* @hibernate.list
* inverse="true"
* lazy="true"
* cascade="all"
* @hibernate.collection-key
* column="userGroupKey"
* @hibernate.collectionIndex
* column="userGroupIndex"
* @hibernate.collection-many-to-many
* column="userGroupIndex"
* class="base.domainobjects.User"
* @return
*/
public List getUsers() {
return users;
}
Code:
/**
* @hibernate.list
* inverse="true"
* lazy="true"
* cascade="all"
* @hibernate.collection-key
* column="userKey"
* @hibernate.collection-index
* column="userIndex"
* @hibernate.collection-many-to-many
* column="userIndex"
* class="base.domainobjects.UserGroup"
* @return
*/
public List getUserGroups() {
return userGroups;
}
When I make the schema, it tells me: org.xml.sax.SAXParseException: Element "list" does not allow "many-to-many" here.
What is wrong?