在eclipse中使用JBossIDE和xDoclet创建EJB

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:
<datasources>
< local-tx-datasource>
< jndi-name>HeliumDS</jndi-name>
< connection-url>jdbc:oracle:thin:@192.168.0.109:1521:labdb</connection-url>
< driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
< user-name>helium</user-name>
< password>helium</password>
<!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
< !--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
< !-- Checks the Oracle error codes and messages for fatal errors -->
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
< !-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
< type-mapping>Oracle9i</type-mapping>
< /metadata>
< /local-tx-datasource>
</datasources>
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"

你可能感兴趣的:(ejb,version,project,Standard,blank)