You must add one more section to your bean descriptor, allowing you to use the environment
variable. The bean's environment is made available to the bean by the container. The values
that are available to the bean are specific to each bean type. The variable values are set up at
deployment time, and are not changeable at runtime. The environment is provided under the
context java:comp/env .
Each environment variable is declared in the deployment descriptor for the bean. The possible
values for these basic variables are: String , Integer , Boolean , Double , Byte , Short , Long , and
Float . The deployment of the interest rate is added to the session description you already have,
and looks like the following code snippet:
The yearly interest rate.
This is just a brief introduction to the uses of the EJB's environment. It is also possible to place
SQL DataSources, other EJB's home interfaces, and other useful items into the environment.
This is a more advanced topic.
This is all we need to provide in the EJB structure part of the deployment descriptor. We will
also provide a small entry in the application assembly section to tell the container how to han-
dle transactions. The entire application assembly description appears as follows:
Here you tell the container that for every method in CalculateLoan , the transaction setting is
Required ; this setting means that if the client is not already involved in a transaction, a new
transaction should be started when entering the bean. How the transactions are handled can be
defined at the method level. Each method in the home and remote interface of your bean could