I need to make some changes to the jbosscmp-jdbc.xml file to enable better dtd validation. The first involves simply renaming the type-mapping element used in the defaults and the entity to datasource-mapping. In the current system type mapping is used in both to identify the type mapping to be used by default or by a specific entity and is used in the declaration of type mappings. The problem is that the xml validating parsers can't check to see if an element contains PCDATA or an xml structure. The new datasource mapping will be as follows:
<defaults> <datasource>java:/PostgresDS</datasource> <datasource-mapping>PostgreSQL</datasource-mapping> </defaults> The next change involves the declaration of relation mappings. Current the relation mapping is as follows: <ejb-relation> <ejb-relation-name>Customer-User</ejb-relation-name> <foreign-key-mapping> <ejb-relationship-role> <ejb-relationship-role-name>customer.getUserLocal()</ejb-relationship-role-n ame> <foreign-key-fields> <foreign-key-field> <field-name>userId</field-name> <column-name>USER_ID</column-name> </foreign-key-field> </foreign-key-fields> </ejb-relationship-role> <ejb-relationship-role> <ejb-relationship-role-name>user.getCustomer()</ejb-relationship-role-name> <foreign-key-fields/> </ejb-relationship-role> </foreign-key-mapping> </ejb-relation> The problem is that there is a co-relation between the outer foreign-key-mapping and the inner foreign-key-field section. This co-relation is impossible to declare in a dtd because the ejb-relationship-role element is also used for the table-key-mapping element. To fix this, I propose moving the two ejb-relationship-role elements outside the mapping element, and changing the foreign-key-field and table-key-field element to a generic key-field element. The with the key-field element you always are declaring the mapping of the primary key of the current entity type. If you are using a foreign key mapping the key field will be added to the related table and if you are using a table key mapping the key field will be added to the relation table. The new mappings are as follows: <ejb-relation> <ejb-relation-name>Customer-User</ejb-relation-name> <foreign-key-mapping/> <ejb-relationship-role> <ejb-relationship-role-name>customer.getUserLocal()</ejb-relationship-role-n ame> <key-fields/> </ejb-relationship-role> <ejb-relationship-role> <ejb-relationship-role-name>user.getCustomer()</ejb-relationship-role-name> <key-fields> <key-field> <field-name>userId</field-name> <column-name>USER_ID</column-name> </key-field> </key-fields> </ejb-relationship-role> </ejb-relation> <ejb-relation> <ejb-relation-name>Customer-Addresses</ejb-relation-name> <table-mapping> <table-name>CUSTOMER_ADDRESS</table-name> <create-table>true</create-table> <remove-table>true</remove-table> </table-mapping> <ejb-relationship-role> <ejb-relationship-role-name>customer.getAddresses()</ejb-relationship-role-n ame> <key-fields> <key-field> <field-name>id</field-name> <column-name>CUSTOMER</column-name> </key-field> </key-fields> </ejb-relationship-role> <ejb-relationship-role> <ejb-relationship-role-name>address.getCustomer()</ejb-relationship-role-nam e> <key-fields> <key-field> <field-name>id</field-name> <column-name>ADDRESS</column-name> </key-field> </key-fields> </ejb-relationship-role> </ejb-relation> I think this change will make the relation mapping easier to read and write. Although I will add some more elements, I think these are the last changes I will have to make until 3.1. Unless someone has a better idea or an objection I will start on these changes soon. -dain _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development