1. create EJB module(lomboz)
2. create EJB (JBoss): package must end with: .ejb
3. Config xDoclet(eclipse project properties)
1. add standard-->standard EJB-->ejb doclet
2. right click ejbdoclet and select jboss
set version: 4.0
set datasource: java:/tutorial
set datasourcemapping: Oracle9i( look up D:\j2ee\jboss-4.0.1\server\default\conf\standardjbosscmp-jdbc.xml for it)
set destDir: simpleejb/META-INF/ (where the the jboss.xml and jbosscmp-jdbc.xml will create)
3. select home, interface,remoteinterface,localhome and select destdir
4. entitypk: set destdir to simpleejb/src
5. set fileset
3. click ok
4. create datasource mapping
1. copy jdbc driver to: D:\j2ee\jboss-4.0.1\server\default\lib
2. create table
3. find D:\j2ee\jboss-4.0.1\docs\examples\jca\oracle-ds.xml and copy it to D:\j2ee\jboss-4.0.1\server\default\deploy
4. update it like below:
HeliumDS
jdbc:oracle:thin:@192.168.0.109:1521:labdb
oracle.jdbc.driver.OracleDriver
helium
helium
org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
Oracle9i
5. edit source code
1. find /**
*@ejb.bean...
replace it with:
/**
* @ejb.bean name="SimpleEntity"
* display-name="Name for SimpleEntity"
* description="Description for SimpleEntity"
* jndi-name="ejb/SimpleEntityHome"
* type="CMP"
* cmp-version="2.x"
* view-type="both"
* local-jndi-name = "ejb/SimpleEntityLocalHome"
* primkey-field = "domainid"
* @ejb.persistence table-name = "domain"
* @jboss.persistence table-name = "domain"
* @ejb:util
* generate="physical"
*
*/
2. for each field, add code like:
/**
* @ejb.interface-method view-type = "both"
* @ejb.persistence column-name = "domainid"
* @ejb.pk-field
* @return
*/
public abstract String getDomainId();
/**
* @ejb.interface-method view-type = "both"
* @param name
*
*/
public abstract void setDomainId(String id);
/**
* @ejb.interface-method view-type = "both"
* @ejb.persistence column-name = "name"
* @return
*/
public abstract String getName();
/** @ejb.interface-method view-type = "both"
* @param name
*/
public abstract void setName(String name);
3. right click project bar and select run xDoclet. Two files are generated: jboss.xml and jbosscmp-jdbc.xml
4. setup packaging configuration: addstandard-->select EJB-->select destDir
5. run packaging
6. copy classes12.jar to D:\j2ee\jboss-4.0.1\server\default\lib
6. JBoss launcher
1. go into debug...
2. select jboss4.0.X
3. put project into source
4. run the server
7. deploy the project