Peculiar error
davidsills Apr 16, 2004 12:44 PMI'm getting a very odd Exception I don't quite understand, even after several hours of looking through documentation, DTDs, and this forum. I'm using the MS Northwind database to test CMP on JBoss 3.2.3 with SQL Server 2000, and what was working fine with 3.2.1 is suddenly not deploying. The problem is occurring with a 1:M unidirectional relationship, perhaps by chance.
The jbosscmp-jdbc.xml file reads (in relevant part) as follows (BTW, the swallowed XML tags _are_ there):
Employees:
<ejb-name>Employees</ejb-name>
java:/jetsontestdls-Northwind
<datasource-mapping>MS SQLSERVER2000</datasource-mapping>
<create-table>false</create-table>
<remove-table>false</remove-table>
<table-name>dbo.Employees</table-name>
<cmp-field>
<field-name>employeeID</field-name>
<column-name>EmployeeID</column-name>
</cmp-field>
...
Orders:
<ejb-name>Orders</ejb-name>
java:/jetsontestdls-Northwind
<datasource-mapping>MS SQLSERVER2000</datasource-mapping>
<create-table>false</create-table>
<remove-table>false</remove-table>
<table-name>dbo.Orders</table-name>
<cmp-field>
<field-name>orderID</field-name>
<column-name>OrderID</column-name>
</cmp-field>
...
1:M Relationship (unidirectional):
<ejb-relation>
<ejb-relation-name>Employees-Orders</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>Employees-has-Orders</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>employeeID</field-name>
<column-name>EmployeeID</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Orders-belongs-to-Employees</ejb-relationship-role-name>
<key-fields/>
</ejb-relationship-role>
</ejb-relation>
The Exception thrown is:
javax.ejb.EJBException: Data source for relationship named Employees-Orders not found java:/DefaultDS
Clearly, it's reading the default datasource from the standardjbosscmp-jdbc.xml file (I haven't deployed a DefaultDS on this server). I would think, however, that it would be able to deduce that since the beans both use "jetsontestdls-Northwind", the relationship will, too. In any case, how do you indicate a datasource for a foreign-key relationship? I don't see any way to do it, but I've obviously missed something.
Thanks in advance for any help!
David Sills