How to migrate your application from JBoss v2.4 to JOnAS v3.0 | ||
---|---|---|
Prev | Chapter 2. Migrating your deployment descriptors | Next |
You have to integrate both jboss.xml and jaws.xml in the JOnAS specific deployment descriptor named jonas-ejb-jar.xml. This file contains, for each bean, the JNDI name of the home object, EJB references, datasource, JMS administered objects and the information about the mapping of the bean to the database. Note that the JNDI configuration used in JOnAS does not support hierarchical namespace so if you used hierarchical JNDI names with jboss.xml you have to change them.
The jboss.xml contains the JNDI name of the beans and of the datasource. You will have to move this to the jonas-ejb-jar.xml file.
This is the jboss.xml file for SB_BrowseRegion:
<jboss> <session> <ejb-name>SB_BrowseRegions</ejb-name> <jndi-name>SB_BrowseRegionsHome</jndi-name> <resource-ref> <res-ref-name>jdbc/rubis</res-ref-name> <resource-name>rubis</resource-name> </resource-ref> </session> </jboss>
The equivalent jonas-ejb-jar.xml file looks like:
<jonas-ejb-jar> <jonas-session> <ejb-name>SB_BrowseRegions</ejb-name> <jndi-name>SB_BrowseRegionsHome</jndi-name> <jonas-resource> <res-ref-name>jdbc/rubis</res-ref-name> <jndi-name>mysql</jndi-name> </jonas-resource> </jonas-session> </jonas-ejb-jar>
This is the jboss.xml file for Region:
<jboss> <entity> <ejb-name>Region</ejb-name> <jndi-name>RegionHome</jndi-name> <resource-ref> <res-ref-name>jdbc/rubis</res-ref-name> <resource-name>rubis</resource-name> </resource-ref> </entity> </jboss>
Here is the equivalent jonas-ejb-jar.xml file:
<jonas-ejb-jar> <jonas-entity> <ejb-name>Region</ejb-name> <jndi-name>RegionHome</jndi-name> <jonas-resource> <res-ref-name>jdbc/rubis</res-ref-name> <jndi-name>rubis</jndi-name> </jonas-resource> </jonas-entity> </jonas-ejb-jar>
The jaws.xml file contains the mapping of the beans to the database tables and the finders declaration. You will have to move this to the jonas-ejb-jar.xml file.
This is the jaws.xml file for Region:
<jaws> <entity> <ejb-name>Region</ejb-name> <table-name>regions</table-name> <create-table>false</create-table> <cmp-field> <field-name>id</field-name> <column-name>id</column-name> </cmp-field> <cmp-field> <field-name>name</field-name> <column-name>name</column-name> </cmp-field> </entity> </jaws>
Here is the equivalent jonas-ejb-jar.xml file:
<jonas-ejb-jar> <jonas-entity> <jdbc-mapping> <jndi-name>mysql</jndi-name> <jdbc-table-name>regions</jdbc-table-name> <cmp-field-jdbc-mapping> <field-name>id</field-name> <jdbc-field-name>id</jdbc-field-name> </cmp-field-jdbc-mapping> <cmp-field-jdbc-mapping> <field-name>name</field-name> <jdbc-field-name>name</jdbc-field-name> </cmp-field-jdbc-mapping> </jdbc-mapping> </jonas-entity> </jonas-ejb-jar>