0 Replies Latest reply on Aug 7, 2005 11:20 PM by George Berish

    My server can't follow my deployement map from Bean to table

    George Berish Novice

      Hi,

      Can anyone help?

      I put my deployment code for a simple test app to create an entity bean below.

      My problem is that I have two database resources:
      DefaultDS (database named jbossdb) and
      ejbTestDS (database named ejbtestdb)

      I thought the code below would mapped my OneBean class to the ejbtestdb.members table.

      But the server keeps trying to persist it in DefalutDS (the jbossdb database) where there is no members table.

      Can anyone point me to where I went wrong?

      [JBoss Home]/server/default/deploy/mysql-ds.xml

      <datasources>
       <local-tx-datasource>
       <jndi-name>DefaultDS</jndi-name>
       <connection-url>jdbc:mysql://localhost:3306/jbossdb</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name></user-name>
       <password></password>
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
       <!-- This may be redundant to standardjbosscmp-jndi.xml? -->
       <metadata>
       <type-mapping>mySQL</type-mapping>
       </metadata>
       </local-tx-datasource>
      
       <local-tx-datasource>
       <jndi-name>ejbTestDS</jndi-name>
       <connection-url>jdbc:mysql://localhost:3306/ejbtestdb</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name></user-name>
       <password></password>
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
       <metadata>
       <type-mapping>mySQL</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>
      [JBoss Home]/server/default/conf/standardjbosscmp-jndi.xml
      <jbosscmp-jdbc>
       <defaults>
       <datasource>java:/DefaultDS</datasource>
       <datasource-mapping>mySQL</datasource-mapping>
       ...
       </defaults>
      
       <type-mappings>
       <type-mapping>
       <name>mySQL</name>
       ...
       </type-mapping>
       <type-mappings>
      </jbosscmp-jdbc>
      [app.ear/app-ejb.jar/META-INF/jboss.xml
      <jboss>
       <enterprise-beans>
       <!-- OneBean -->
       <entity>
       <ejb-name>OneBeanEJB</ejb-name>
       ...
       <resource-ref>
       <res-ref-name>ejbTestDS</res-ref-name>
       <jndi-name>java:/xDS</jndi-name>
       </resource-ref>
       </entity>
       </enterprise-beans>
       </jboss>
      [app.ear/app-ejb.jar/META-INF/jbosscmp-jndi.xml
      jbosscmp-jdbc>
       <enterprise-beans>
       <!-- MemberBean -->
       <entity>
       <ejb-name>OneBeanEJB</ejb-name>
       <create-table>false</create-table>
       <table-name>members</table-name>
      
       <cmp-field>
       <field-name>pk</field-name>
       <column-name>ID</column-name>
       <not-null/>
       <auto-increment/>
       </cmp-field>
       ...
       </entity>
       </enterprise-beans>
      </jbosscmp-jdbc>
      [app.ear/app-ejb.jar/META-INF/ejb-jar.xml
      <ejb-jar>
       <enterprise-beans>
       <!-- OneBean -->
       <entity>
       <ejb-name>OneBeanEJB</ejb-name>
       ...
       <persistence-type>Container</persistence-type>
       ...
       <prim-key-class>java.lang.Integer</prim-key-class>
       ...
       <abstract-schema-name>OneBeanSchema</abstract-schema-name>
       <cmp-field><field-name>pk</field-name></cmp-field>
       <cmp-field><field-name>userId</field-name></cmp-field>
       ...
       <primkey-field>pk</primkey-field>
       <resource-ref>
       <res-ref-name>ejbTestDS</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       <res-sharing-scope>Shareable</res-sharing-scope>
       </resource-ref>
       </entity>
       </enterprise-beans>
      </ejb-jar>