Skip Headers
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g (

Part Number E13981-01
Go to Documentation Home
Go to Book List
Book List
Go to Table of Contents
Go to Index
Go to Feedback page
Contact Us

Go to previous page
Go to next page
View PDF

Configuring an Environment Reference to an Environment Variable

You can create environment variables that your bean accesses through a JNDI lookup on the InitialContext. These variables are defined within an ejb-jar.xml file <env-entry> element and can be of the following types: String, Integer, Boolean, Double, Byte, Short, Long, and Float. The environment variable name is defined in the <env-entry-name> subelement, the type is defined in the <env-entry-type> subelement, and the value is defined in the <env-entry-value> subelement. The <env-entry-name> is relative to the "java:comp/env" context.

Example 19-17 shows how to define environment variables for java:comp/env/minBalance and java:comp/env/maxCreditBalance in the ejb-jar.xml file.

Example 19-17 ejb-jar.xml For Environment Variables


You can override an environment variable value defined in the ejb-jar.xml file by defining an env-entry-mapping element in your orion-ejb-jar.xml file, whose name attribute matches the env-entry-name defined in the ejb-jar.xml file. The type specified in the ejb-jar.xml file stays the same.

Figure 19-7 shows how the minBalance environment variable value is overridden by the orion-ejb-jar.xml file and set to 500.

Figure 19-7 Overriding Environment Variables in ejb-jar.xml with orion-ejb-jar.xml

Description of Figure 19-7 follows
Description of "Figure 19-7 Overriding Environment Variables in ejb-jar.xml with orion-ejb-jar.xml"

For more information on looking up environment variables, see the following:

"Looking Up an EJB 3.0 Environment Variable"

"Looking Up an EJB 2.1 Enviornment Variable"