Skip Headers

Oracle® Application Server Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 2 (10.1.2)
Part No. B15505-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Modify XML Deployment Descriptors

In addition to the configuration described in "Creating Entity Beans", you must modify and add the following to your ejb-jar.xml deployment descriptor:

  1. Configure the persistence type to be "Bean" in the <persistence-type> element.

  2. Configure a resource reference for the database persistence storage in the <resource-ref> element.

    The employee example used the database environment element of "jdbc/OracleDS". This is configured in the <resource-ref> element as follows:

    <resource-ref>
     <res-ref-name>jdbc/OracleDS</res-ref-name>
     <res-type>javax.sql.DataSource</res-type>
     <res-auth>Application</res-auth>
    </resource-ref>
    

The database specified in the <res-ref-name> element maps to a <ejb-location> element in the data-sources.xml file. Our "jdbc/OracleDS" database is configured in the data-sources.xml file, as shown below:

<data-source
  class="com.evermind.sql.DriverManagerDataSource"
  name="Oracle"
  location="jdbc/OracleCoreDS"
  pooled-location="jdbc/pool/OraclePoolDS"
  ejb-location="jdbc/OracleDS"
  xa-location="jdbc/xa/OracleXADS"
  connection-driver="oracle.jdbc.driver.OracleDriver"
  url="jdbc:oracle:thin:@myhost:1521:orcl"
  username="scott"
  password="tiger"
  max-connections="300"
  min-connections="5"
  max-connect-attempts="10"
  connection-retry-interval="1"
  inactivity-timeout="30"
  wait-timeout="30"
/>

Note:

The entire BMP entity bean example is available on OTN from the OC4J sample code page at http://www.oracle.com/technology/tech/java/oc4j/demos/ on the OTN Web site.