-
1. Re: Is this A dumb Question -- How to map table name to bean
darranl Aug 7, 2005 6:01 AM (in response to gberish)The file you are looking for is called 'jboss.xml', the DTD for this file is in the {jboss.home}/docs/dtd folder of your JBoss installation.
-
2. Re: Is this A dumb Question -- How to map table name to bean
gberish Aug 7, 2005 11:09 PM (in response to gberish)Thanx, but I I couldn't set the table name in jboss.xml and had to use do it in jbosscmp-jdbc.xml.
However, now server keeps looking for its table (members) in the DefaulDS resource (jbossdb database) instead of in the ejbTestDS resource (ejbtestdb database) where I created members.
I can't figue out why.
In case anyone can use what I found so far or is willing to tell me where the server gets pointed to the DefautDs in error, here is my deployment structure.
It is from top (server) to down (my ejb-jar.xml) -- it sure seems to track from the bean to the ejbTestDs resource (ejbtestdb database) to the members table.
Can anyone tell me where it gets lost?
[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.xmljbosscmp-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>