Problems using container managed relation
runningboy Aug 22, 2002 12:45 PMHi, I'm a long time reader first time poster. I have just started using jBoss for my first big project and am running into problems with the CMP and using container managed relationships.
I have a session EJB which is meant to correspond with a principal EJB. Unfortunately right now when I try to express this I get the following exception:
2002-08-22 09:13:04,501 ERROR [org.jboss.ejb.EjbModule] Initialization failed
org.jboss.deployment.DeploymentException: Role: Session-applies-to-a-Principal with multiplicity
many using foreign-key mapping is not allowed to have key-fields
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.loadKeyFields(JD
BCRelationshipRoleMetaData.java:357)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.init(JDBCRelatio
nshipRoleMetaData.java:157)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationMetaData.(JDBCRelationMetaD
ata.java:309)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.(JDBCApplicatio
nMetaData.java:383)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java
:75)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManag
er.java:601)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.create(JDBCStoreManager.java:321)
at org.jboss.ejb.plugins.CMPPersistenceManager.create(CMPPersistenceManager.java:155)
at org.jboss.ejb.EntityContainer.create(EntityContainer.java:337)
at org.jboss.ejb.Container.invoke(Container.java:789)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:894)
at $Proxy6.create(Unknown Source)
I am using xDoclet to express the relation between the two beans using the following markup:
// ***********************
// Relationship properties
// ***********************
/**
* Get the principal that this session applies too.
*
* @ejb:relation name="Session-Principal"
* role-name="Session-applies-to-a-Principal"
* cascade-delete="yes"
* @jboss:relation fk-constraint="false"
* related-pk-field="id"
* fk-column="principal_id"
* @ejb:interface-method view-type="local"
*/
public abstract PrincipalLocal getPrincipal();
/**
* Set the principal that this session applies too.
*
* @ejb:interface-method view-type="local"
*/
public abstract void setPrincipal(PrincipalLocal principal);
and,
// ***********************
// Relationship properties
// ***********************
/**
* Get the principal that this session applies too.
*
* @ejb:relation name="Session-Principal"
* role-name="Session-applies-to-a-Principal"
* cascade-delete="yes"
* @jboss:relation fk-constraint="false"
* related-pk-field="id"
* fk-column="principal_id"
* @ejb:interface-method view-type="local"
*/
public abstract PrincipalLocal getPrincipal();
/**
* Set the principal that this session applies too.
*
* @ejb:interface-method view-type="local"
*/
public abstract void setPrincipal(PrincipalLocal principal);
If anyone has any idea what's up I would really appreciate some advice. I haven't been able to find many references to this error, though I did find where it comes from in the source! :p
Cheers!
-Mark