-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: many-to-many with XDoclet
PostPosted: Sat Nov 15, 2003 10:02 am 
Regular
Regular

Joined: Sat Oct 11, 2003 11:13 am
Posts: 69
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?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 15, 2003 6:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Firstly there is a typo in the Xdoclet tags in the users for the collection index. Other than that I work better looking at the hbm then I mentally map it back to XDoclet. Why don't you create a test mapping and get it to work then map it back to XDoclet, eg, add/change tags until it generates what your expecting.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.