Ben Litchfield
2002-11-17 19:01:01 UTC
Any help would be great. I am not sure if this is a
middlegen/xdoclet/jboss problem.
I am trying to get a very simple many-to-many relationship working. I am
getting the following error when I deploy
12:54:09,685 WARN [ServiceController] Problem starting service
jboss.j2ee:jndiName=users.UserinfoLocal,service=EJB
org.jboss.deployment.DeploymentException: CMP field for key not found:
field name=roleId
at
org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.
loadKeyFields(JDBCRelationshipRoleMetaData.java:374)
Here is my table create script
CREATE TABLE userinfo
(
userinfo_id INT PRIMARY KEY,
name VARCHAR(4000) NOT NULL
);
CREATE TABLE role
(
role_id INT PRIMARY KEY,
rolename VARCHAR(4000) NOT NULL
);
CREATE TABLE userinfo_role
(
role_id INT REFERENCES role(role_id),
userinfo_id INT REFERENCES userinfo(userinfo_id)
);
Here is my middlegen/ejbdoclet tasks
<middlegen
appname="${project.name}"
prefsdir="${config.dir}"
gui="false"
databaseurl="${database.url}"
initialContextFactory="${java.naming.factory.initial}"
providerURL="${java.naming.provider.url}"
datasourceJNDIName="${jboss.datasource.name}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
<many2many>
<tablea generate="true" name="userinfo"/>
<jointable generate="false" name="userinfo_role"/>
<tableb generate="true" name="role"/>
</many2many>
<cmp20
destination="${gen.src.dir}"
package="${ejb.package.name}"
interfacepackage="${ejb-client.package.name}"
jndiprefix="${project.name}"
pkclass="false"
dataobject="true"
viewtype="local"
readonly="false"
fkcmp="false"
guid="true"
localsuffix="Local"
localhomesuffix="Local"
<sequenceblock
blocksize="5"
retrycount="2"
table="SEQ_BLOCK"
/>
<jboss/>
</cmp20>
</middlegen>
<ejbdoclet destdir="${gen.src.dir}" excludedtags="@version,@author"
ejbspec="2.0">
<packageSubstitution packages="entity.ejb" substituteWith="entity"/>
<fileset dir="${gen.src.dir}">
<include name="**/ejb/**/*Bean.java" />
</fileset>
<fileset dir="${src.dir}">
<include name="**/**/*Bean.java" />
</fileset>
<utilobject kind="physical"/>
<!--<localinterface pattern="{0}"/>
<localhomeinterface pattern="{0}Home" />-->
<homeinterface/>
<remoteinterface/>
<localinterface/>
<localhomeinterface/>
<dataobject/>
<session/>
<entitypk/>
<entitycmp/>
<deploymentdescriptor
xmlencoding="ISO-8859-1"
destdir="${config.dir}"
validatexml="true"
/>
<jboss
version="3.0"
xmlencoding="ISO-8859-1"
destdir="${config.dir}"
validatexml="true"
datasource="${jboss.datasource.name}"
datasourcemapping="${jboss.datasource.mapping}"
/>
</ejbdoclet>
middlegen/xdoclet/jboss problem.
I am trying to get a very simple many-to-many relationship working. I am
getting the following error when I deploy
12:54:09,685 WARN [ServiceController] Problem starting service
jboss.j2ee:jndiName=users.UserinfoLocal,service=EJB
org.jboss.deployment.DeploymentException: CMP field for key not found:
field name=roleId
at
org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.
loadKeyFields(JDBCRelationshipRoleMetaData.java:374)
Here is my table create script
CREATE TABLE userinfo
(
userinfo_id INT PRIMARY KEY,
name VARCHAR(4000) NOT NULL
);
CREATE TABLE role
(
role_id INT PRIMARY KEY,
rolename VARCHAR(4000) NOT NULL
);
CREATE TABLE userinfo_role
(
role_id INT REFERENCES role(role_id),
userinfo_id INT REFERENCES userinfo(userinfo_id)
);
Here is my middlegen/ejbdoclet tasks
<middlegen
appname="${project.name}"
prefsdir="${config.dir}"
gui="false"
databaseurl="${database.url}"
initialContextFactory="${java.naming.factory.initial}"
providerURL="${java.naming.provider.url}"
datasourceJNDIName="${jboss.datasource.name}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
<many2many>
<tablea generate="true" name="userinfo"/>
<jointable generate="false" name="userinfo_role"/>
<tableb generate="true" name="role"/>
</many2many>
<cmp20
destination="${gen.src.dir}"
package="${ejb.package.name}"
interfacepackage="${ejb-client.package.name}"
jndiprefix="${project.name}"
pkclass="false"
dataobject="true"
viewtype="local"
readonly="false"
fkcmp="false"
guid="true"
localsuffix="Local"
localhomesuffix="Local"
<sequenceblock
blocksize="5"
retrycount="2"
table="SEQ_BLOCK"
/>
<jboss/>
</cmp20>
</middlegen>
<ejbdoclet destdir="${gen.src.dir}" excludedtags="@version,@author"
ejbspec="2.0">
<packageSubstitution packages="entity.ejb" substituteWith="entity"/>
<fileset dir="${gen.src.dir}">
<include name="**/ejb/**/*Bean.java" />
</fileset>
<fileset dir="${src.dir}">
<include name="**/**/*Bean.java" />
</fileset>
<utilobject kind="physical"/>
<!--<localinterface pattern="{0}"/>
<localhomeinterface pattern="{0}Home" />-->
<homeinterface/>
<remoteinterface/>
<localinterface/>
<localhomeinterface/>
<dataobject/>
<session/>
<entitypk/>
<entitycmp/>
<deploymentdescriptor
xmlencoding="ISO-8859-1"
destdir="${config.dir}"
validatexml="true"
/>
<jboss
version="3.0"
xmlencoding="ISO-8859-1"
destdir="${config.dir}"
validatexml="true"
datasource="${jboss.datasource.name}"
datasourcemapping="${jboss.datasource.mapping}"
/>
</ejbdoclet>