Customizing Business Logic with EJB Environment Entries

Environment entries are name-value pairs that allow you to customize the bean's business logic. Since environment entries are stored in an enterprise bean's deployment descriptor, a bean's business logic can be changed without changing its source code.

For example, an EJB that calculates an order might give a discount depending on the number of items ordered, a certain status (silver, gold, platinum), or for a promotion. Before deploying the bean's application you could assign the discount a certain percentage. When the application runs, a method would call the environment entry to find out the discount value. If you wanted to change that percentage in a different deployment, you would not need to change the source code, you would just need to change the value in the environment entries for the deployment descriptor.

To add or modify EJB environment entries:

  1. In the System Navigator, right-click on an EJB and choose EJB Module Editor.
  2. Expand the node for the bean you are editing.
  3. Click the Environment node.

For more information on using this dialog, click Help or press the F1 key.


Related topics

Developing Enterprise JavaBeans

 

 

 

Copyright © 1997, 2004, Oracle. All rights reserved.