CMP, CMR, Unidirectional relationship one-to-many (using XDo
zaphod Mar 22, 2003 4:42 AMI don't know if these Threads are related??
http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ least I have a different point of view...
Plans are: one to many relation with unidirectional mapping on the one side. Primary keys are compound keys. Use of XDoclet...
Versions: XDoclet 1.2b2, Ant 1.5.1, JBOSS: jboss-3.0.6_tomcat-4.1.18
Primary key on the one side (SET):
mandateId, moduleId, setId
Primary key on the many (blind) side (EXT):
languageId, mandateId, extId
Lookup key on the one side (SET):
mandateId(=part of PK), extId
=================
Here is the relevant code snipped from the set EJB:
/**
* @ejb.interface-method"
* @ejb.relation
* name="set-ext"
* role-name="one set has many exts"
* target-ejb="Ext"
* target-role-name="one ext has one set"
* target-multiple=yes"
*
* @ejb.value-object
* aggregate="magellan.domain.ext.model.ExtValue"
* aggregate-name="Ext"
* members="magellan.domain.ext.interfaces.ExtLocal"
* members-name="Ext"
* relation="external"
* type="Collection"
* @ejb.relation
* name="set-ext"
* target-role-name="one ext has one set"
*
* @jboss.target-relation
* fk-column="OA_00MAN_ID"
* related-pk-field="mandateId"
* fk-contraint="${db.foreign.key}"
* @jboss.target-relation
* fk-column="OA_00EXT_ID"
* related-pk-field="extId"
* fk-contraint="${db.foreign.key}"
*
*/
public abstract Collection getExtTerms();
/**
* @ejb:interface-method
*/
public abstract void setExtTerms(Collection extTerms);
===================
builds fine but at deployment I get the following message:
...
10:27:20,277 INFO [EjbModule] Creating
10:27:20,287 INFO [EjbModule] Deploying Language
10:27:20,317 INFO [EjbModule] Deploying Set
10:27:20,988 INFO [EjbModule] Deploying Ext
10:27:21,058 INFO [EjbModule] Created
10:27:21,058 INFO [EjbModule] Starting
10:27:21,208 WARN [ServiceController] Problem starting service jboss.j2ee:jndiN
ame=local/magellan.util.uidgen.Counter,service=EJB
org.jboss.deployment.DeploymentException: CMP field for key not found: field nam
e=extId
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.
loadKeyFields(JDBCRelationshipRoleMetaData.java:374)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.
init(JDBCRelationshipRoleMetaData.java:157)
I think the problem is that a part of the (lookup) key is used as a primary key on the one side. Agree?? I heard (sourceforge) that this is a known problem with JBOSS and will be fixed with version 4.0. Is that right?
Is there a workarround or some hope that this will be in 3.2?
Please tell me that I made something wrong an that it is easy to fix :-))