0 Replies Latest reply on Jun 13, 2003 8:40 AM by apfeuti

    foreign-key-mapping default datasource

    apfeuti Newbie

      Hello

      I have to EJBs with a 1 - n relation. I use CMR with JBoss 3.0.6

      In the jbosscmp-jdbc.xml I configured the dataSource like this:

      <ejb-name>BeanA</ejb-name>
      java:/myDS
      <datasource-mapping>MS SQLSERVER2000</datasource-mapping>
      <table-name>myTable_A</table-name>

      the same princip is done for BeanB.

      So both Beans know their datasource.

      But when I make a call on BeanA like this:

      getBeanB(); //should return a Collection of BeanB
      then I got an empty Collection.

      The problem is the following: JBoss tries to resolve the relation via the defaultDS (in my case the Hypersonic-DB).

      When I do this entry in the jbosscmp-jdbc.xml:


      java:/myDS
      <datasource-mapping>MS SQLSERVER2000</datasource-mapping>


      I do not have longer this problem, and all works fine.

      But this entry makes for me no sense. Both tables allready know their datasource!

      When I have really to do the default-entry like described above, this has drawbacks:

      - I can only deploy beans in the same jar with the same datasource

      - I do not know how to generate jbosscmp-jdbc.xml with XDoclet.

      Does anybody knows if the default-entry is really needed, and if yes how to use XDoclet for that.

      Thanks a lot.
      Andreas