WAS v8.5 > End-to-end paths > EJB applicationsTasks: Using enterprise beans in applications
This article provides an overview of the tasks perform to use enterprise beans in a Java based application.
Use the following steps to develop an EJB application:
- EJB 3.x beans: Design a Java EE application and the enterprise beans that it needs.
- EJB 2.x beans: Design a J2EE application and the enterprise beans that it needs.
- Develop any enterprise beans the application uses. See the topic Developing enterprise beans.
- Prepare for assembly. For custom EJB 2.x-compliant entity beans decide on an appropriate access intent policy. For more information about using access intent, see the topic, Using access intent policies for EJB 2.x entity beans.
- Assemble the beans into one or more EJB modules using one of the assembly tools. See the topic Assembling EJB modules.
This process includes setting security. See the topic Securing enterprise bean applications to learn more about setting the security.
For custom EJB 2.x-compliant entity beans, you might also want to designate container-managed persistence sequence groups. See the topic Setting the run time for CMP sequence groups.
- EJB 3.x beans: Assemble the beans into one or more EJB 3.x modules using one of the assembly tools. See the topic Assembling EJB 3.x modules.
- Assemble the modules into a Java EE application using the assembly tool.
- Update the EJB container configuration for a given application if needed for the application to be deployed. See the topic Managing EJB containers.
- Update the EJB container configuration for a given application server if needed for the application to be deployed, and determine to batch commands or defer commands for container-managed persistence. See the topics Managing EJB containers, Setting the run time for batched commands with JVM arguments, and Setting the run time for deferred create with JVM arguments.
- Deploy the application in an application server. See the topic Deploying EJB modules.
- Test the modules.
- As needed, debug problems with the container. For more information see the topic Enterprise bean and EJB container troubleshooting tips.
- Debug access problems. See the topic Enterprise bean cannot be accessed from a servlet, a JSP file, a stand-alone program, or another client.
- Assemble the production application using one of the assembly tools
- Deploy the application to a production environment.
- Manage the application:
- Manage installed EJB modules. After an application has been installed, we can manage its EJB modules individually through assembly tools.
- Manage other aspects of the Java application. See the topic Deploying and administering enterprise applications
- Update the module and redeploy it using one of the assembly tools.
- Tune the performance of the application. See the topic Best practices for developing enterprise beans.
Subtopics
- Enterprise beans
An enterprise bean is a Java component that can be combined with other resources to create Java applications. There are three types of enterprise beans, entity beans, session beans, and message-driven beans.- Develop enterprise beans
One of two enterprise bean development scenarios is typically used with the product. The first is command-line using Ant, Make, Maven or similar tools. The second is an IDE-based development and build environment. The steps in this article focus on development without an IDE.- Use access intent policies for EJB 2.x entity beans
We can use access intent policies to help the product runtime environment manage various aspects of EJB persistence.- EJB modules
An EJB module is used to assemble one or more enterprise beans into a single deployable unit. An EJB module is stored in a standard JAR file.- Assemble EJB modules
An enterprise bean is a Java component that can be combined with other resources to create Java Platform Enterprise Edition (Java EE) applications. This topic describes assembling EJB modules based on the EJB specifications.- EJB containers
An EJB container provides a run-time environment for enterprise beans within the application server. The container handles all aspects of an enterprise bean's operation within the application server and acts as an intermediary between the user-written business logic within the bean and the rest of the application server environment.- Manage EJB containers
Each application server can have a single EJB container; one is created automatically for you when the application server is created. The following steps are to be performed only as needed to improve performance after the EJB application has been deployed.- Deploy EJB modules
When you deploy an EJB module, you install that module on a server that has been configured to support deployed modules.- Tasks: Storing and retrieving persistent data with the JPA API
The JPA for the application server defines the management of persistence and object and relational mapping within Java EE and Java Standard Edition (Java SE) environments.- Configure persistence provider support in the application server
Persistence providers are implementations of the JPA specification and can be deployed in the Java EE compliant application server that supports JPA persistence.- Associate persistence providers and data sources
JPA applications specify the underlying data source used by the persistence provider to access the database.- Configure OpenJPA caching to improve performance
The OpenJPA implementation gives you the option of storing frequently used data in the memory to improve performance. OpenJPA provides concurrent data and concurrent query caches that support applications to save persistent object data and query results in memory to share among threads and for use in future queries.- Troubleshooting JPA applications
Use this information to find various known problems with JPA applications.- EJB method Invocation Queuing
Method invocations to enterprise beans are only queued for remote clients making the method call. An example of a remote client is an EJB client running in a separate JVM (another address space) from the enterprise bean. In contrast, no queuing occurs if the EJB client, either a servlet or another enterprise bean, is installed in the same JVM on which the EJB method runs, and on the same thread of execution as the EJB client.- Secure enterprise bean applications
We can protect enterprise bean methods by assigning security roles to them. Before you assign security roles, you need to know which EJB methods need protecting and how to protect them.- Enterprise bean and EJB container troubleshooting tips
- Enterprise bean cannot be accessed from a servlet, a JSP file, a stand-alone program, or another client
Use these troubleshooting tips for problems related to accessing enterprise beans.
Related concepts:
EJB 3.x module packaging overview
Related
Assemble applications
Deploy enterprise applications
Reference:
Enterprise bean development best practices