I believe you should be using relation rather than target-relation.
target-relation is for uni-directional relationships where you
need to specify both sides of the relationship on one getter method.
Everything else looks ok to me. I am using m-n relationships with
JBoss 3.0.2 and xdoclet 1.1.2 and it is working ok. Here are
my xdoclet tags for an m-n relationship...
/**
*
* @ejb:relation
*name=Job-TechObject
*role-name=TechObject-has-many-Jobs
*
* @jboss:relation
*related-pk-field=id
*fk-column=JobId
*
* @jboss:relation-table
*table-name=Job_TechObject
*
* @ejb:interface-method
*/
public abstract Collection getJobs();
/**
* Retrieve the Collection of TechObjects that the Job involves.
* For example, TechObjects to be inspected.
*
* @return Returns a Collection of TechObjectLocal (local interfaces
* to TechObjects) that this Job involves.
*
* @ejb:relation
*name=Job-TechObject
*role-name=Job-involves-many-TechObjects
*
* @ejb:interface-method
*
* @jboss:relation
*related-pk-field=id
*fk-column=TechObjectId
*
* @jboss:relation-table
*table-name=Job_TechObject
*
**/
public abstract Collection getTechObjects();
Have a look at the xdcolet generated ejb-jar.xml and jbosscmp-jdbc.xml files
and make sure that xdoclet is generating what you expect.
Regards
Chris
-Original Message-
From: Victor Batista [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 24 September 2002 5:19 AM
To: [EMAIL PROTECTED]
Subject: [JBoss-user] M-N relationship error -xdoclet
Hello!
I am having problems while creating a M-N relationship using xdoclet. I am
using jboss3.0.0 with bundled Tomcat 4.0.3. I am also using xdoclet 1.1.2.
Do i need to get the latest xdcolet from CVS?
I am getting the following exception for both roles:
org.jboss.deployment.DeploymentException: Both roles of a relation-table
mapped relationship must have key fields: ejb-relation-name=User-Role
My xdoclet tags are:
UserBean:
#
@ejb:relation name=User-Role
role-name=User-Has-Many-Roles
@jboss:relation-table table-name=xpto
@jboss:target-relation related-pk-field=id
fk-column=roleid
#
where id is the name of the primary key on the Role bean and roleid is
the name of the column in the relation table (xpto).
RoleBean:
#
@ejb:relation name=User-Role
role-name=Role-Has-Many-Users
@jboss:relation-table table-name=xpto
create-table=true
remove-table=true
@jboss:target-relation related-pk-field=id
fk-column=userid
#
where id is the name of the primary key on the User bean and userid is
the name of the column in the relation table (xpto).
I have tried with jboss:relation instead of jboss:target-relation but
with the same results.
Can any one help me, please?
Thank you in advance,
Victor Batista
---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user
---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user