ejb-jar.xml Visual Editor: Bean Environment

See Also 

The ejb-jar.xml visual editor lets you edit the general for an EJB module. You open the editor by expanding the project's Configuration Files node in the Projects window and double-clicking ejb-jar.xml. The Enterprise Beans section of the General tab contains a section for each of your EJB module's enterprise beans.

Each enterprise bean has a Bean Environment section, which lets you specify the following information:

Enterprise Bean References

Lists all of the enterprise beans that a particular bean references. When you add a bean reference through the ejb-jar.xml visual editor, the IDE adds a reference to the bean in the deployment descriptorand creates lookup code for the referenced bean in the bean implementation class of the enterprise bean.

You can also add enterprise bean references by right-clicking in the bean class for an enterprise bean and choosing Insert Code > Call Enterprise Bean.

Environment Entries

In the Environment Entries section, you can define properties in the deployment descriptor that you can then access in the code of your EJB module. For example, an entry name of a enterprise bean that calculates money exchanges might be PoundToDollar and the value for this entry might be 1.55, which indicates the pound-to-dollar exchange rate.

The environment entry values can be one of the following Java types: String, Character, Integer, Boolean, Double, Byte, Short, Long, and Float. Make sure that each entry's value matches its type. Also make sure that the name for each entry is unique in each enterprise bean.

Resource References

In the Resource References section, you can define references that your bean needs to access server resources. These resources can include the following:

JMS data sources and JDBC data sources are registered automatically when you use the Send JMS Message and Use Database commands.

For each resource reference, you need to do the following:

Resource Environment References

Resource environment references are another type of environment entries. They allow you to refer to administered objects that are associated with resources (for example, JMS Destinations), by using logical names. You can type the name, resource type, and optionally a description for each resource environment reference.

Security Role References

In the Security Role References section, you can link a reference name used in your code to a security role defined on the application server. The value in the Reference Name column must be the security role name that is used as a parameter to the isCallerInRole(String roleName) method in your enterprise bean.

All enterprise beans also have the following sections in the ejb-jar.xml visual editor:

See Also
About Configuring EJBModules
Verifying an Enterprise Application
ejb-jar.xml Visual Editor:
         Module Details
         Security Roles
         Enterprise Beans: Entity Bean
         Enterprise Beans: Session Bean
         Enterprise Beans: Message-Driven Beans
         CMP Relationships

Legal Notices