Data source for relationship named...not found
tpoppe Apr 9, 2003 12:50 PM
I'm using XDoclet 1.2b2 to generate my CMP beans, and I want to build a one to many bidirectional CMR for several of my entity beans. However, when I follow some of the examples, I get the following exception on deployment:
javax.ejb.EJBException: Data source for relationship named ReviewsInAPerformancePlanRelation not found jdbc/PMSDS
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationMetaData.getDataSource(JDBCRelationMetaData.java:611)
at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.resolveRelationship(JDBCCMRFieldBridge.java:171)
at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.resolveRelationships(JDBCEntityBridge.java:130)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.resolveRelationships(JDBCStoreManager.java:421)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:361)
at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:198)
at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
at org.jboss.ejb.Container.invoke(Container.java:756)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:1003)
at $Proxy4.start(Unknown Source)
....
My XDoclet (on the many side of the relationship is:
/**
* @ejb.relation
* name = "ReviewsInAPerformancePlanRelation"
* role-name = "ReviewInAPerformancePlan"
* cascade-delete = "no"
*
* @ejb.interface-method
* view-type = "local"
*
* @jboss.relation-mapping
* style="foreign-key"
*
* @jboss.relation
* fk-constraint = "true"
* fk-column = "performancePlanID"
* related-pk-field = "performancePlanID"
*/
and the XDoclet on the one side:
/**
* @ejb.relation
* name = "ReviewsInAPerformancePlanRelation"
* role-name = "PerformancePlanHasReviews"
* cascade-delete = "no"
*
* @ejb.interface-method
* view-type = "local"
*
* @jboss.relation-mapping
* style="foreign-key"
*/
The generated ejb-jar.xml (relevant to this):
<ejb-relation >
<ejb-relation-name>ReviewsInAPerformancePlanRelation</ejb-relation-name>
<ejb-relationship-role >
<ejb-relationship-role-name>ReviewInAPerformancePlan</ejb-relationship-role-name>
Many
<relationship-role-source >
<ejb-name>Review</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>performancePlan</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role >
<ejb-relationship-role-name>PerformancePlanHasReviews</ejb-relationship-role-name>
One
<relationship-role-source >
<ejb-name>PerformancePlan</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>reviews</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
The jbosscmp-jdbc.xml relevant:
<ejb-relation>
<ejb-relation-name>ReviewsInAPerformancePlanRelation</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>ReviewInAPerformancePlan</ejb-relationship-role-name>
<fk-constraint>true</fk-constraint>
<key-fields/>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>PerformancePlanHasReviews</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>performancePlanID</field-name>
<column-name>performancePlanID</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>
No where in the related XMLs is there any reference to the datasource that is listed in the exception. (The datasource name is infact correct.)
Where is the datasource name coming from? and why is it throwing an exception? Are my XDoclet's off?
Any help is greatly appreciated.
Thanks
Troy Poppe