Show TOC

Procedure documentationEditing EJB Environment Locate this document in the navigation structure

 

The business logic of an application is not a constant part. After its delivery, it is possible that new requirements for additional functionality appear. This can be as part of the following scenarios:

  • You have expected some changes and you have prepared an alternative business logic or you have parametrized the original one in the same application. In this case you want to switch to the alternative or change the parameters.

  • You deliver new functionality in an additional application. In this case you want to switch to this application.

You can achieve this redirection by changing the EJB References or Environment Entries, where with EJB References you change entire parts of the business logic, whereas the Environment Entries are used to change the business logic parameters.

For simplicity, let us have two beans that represent the business logic of an already existing application, the first bean accesses the second one through a particular business interface. If you want to customize this application you can change the behavior of the first bean by redirecting its implementation to another bean (inside the existing application or as a part of a separate application) or you can change some of the parameters (Environment Entries) of the current business logic.

This graphic is explained in the accompanying text.

EJB Redirection

When redirecting session bean B1 from session bean C1 to session bean C2, you have to change the beanName, the jarName and the appName. The interfaceName cannot be changed. It can be specified only in the source code of the business logic.

EJB References

If you want to use the EJB redirection to switch your business logic and if the EJB reference is specified in annotation, you have to use the mappedName attribute of the@EJB annotation. The actual redirection can be done by editing the mappedName annotation attribute of the bean. The mappedName has a SAP-specific format that uses the EJB lookup scheme.

More information: EJB Lookup Scheme

Note Note

To change the annotation attribute mappedName you need to use all keys of the EJB lookup scheme: appName,jarName, beanName and interfaceName. If the additional business logic is in a separate application, you need to change the appName and (or) the jarName and (or) the beanName. In case the additional business logic is in the same application, you need to change only the beanName and (or) the jarName. In both cases all the keys need to be present. The interfaceType is optional.

End of the note.

If the EJB reference is specified in the ejb-j2ee-engine.xml, you have to change its JNDI name using the SAP NetWeaver Administrator. The JNDI name uses the EJB lookup scheme as well.

Environment Entries

You can edit Environment Entries as well. Using the SAP NetWeaver Administrator you can change their value by saving the new configuration without redeploying the application.

Procedure

  1. Open the SAP NetWeaver Administrator.

  2. Choose   Configuration Management   Infrastructure   Application Modules  .

  3. Select the desired EJB Module by sorting the Module List section by Name, Type or Application.

  4. In the EJB Module Details section, choose the Enterprise JavaBeans tab and select a bean from the list.

  5. In the EJB Module Details section, choose the Environment & References tab.

    Note Note

    The EJB Module has to contain Environment Entry or Resource References.

    End of the note.
    • If you have Annotated EJB Reference type, change the mappedName of the EJB Reference in the Mapped Name field in the General tab of the Full Details section.

    • If you have EJB Local Reference or EJB Remote Reference type, change the JNDI name of the EJB Reference in the JNDI Name field in the General tab of the Full Details section.

    • If you have Resource Environment Reference type, change the value of the Environment Entry in the Value field in the General tab of the Full Details section.

  6. Choose Save.

By default, all changes are applied after the application is restarted.

If you want to restore the original settings of the application, choose Get Default.