Chapter 1. Introduction

1.1. Overview of Jakarta Enterprise Beans

Jakarta Enterprise Beans is an API for developing distributed, transactional, secure and portable Jakarta EE applications through the use of server-side components called Enterprise Beans. Enterprise Beans implement the business logic of an application in a decoupled manner that encourages reuse. Jakarta Enterprise Beans is documented at Jakarta Enterprise Beans 3.2 specification.

1.2. Jakarta Enterprise Beans 3.2 Feature Set

The following Jakarta Enterprise Beans 3.2 features are supported by JBoss EAP 7.3 and later versions:

  • Session beans
  • Message-driven beans
  • Jakarta Enterprise Beans API groups
  • No-interface views
  • Local interfaces
  • Remote interfaces
  • AutoClosable interface
  • Timer service
  • Asynchronous calls
  • Jakarta Interceptors
  • RMI/IIOP interoperability
  • Transaction support
  • Security
  • Embeddable API

The following features are no longer supported by JBoss EAP 7:

  • EJB 2.1 entity bean client views
  • Entity beans with bean-managed persistence
  • Entity beans with container-managed persistence
  • EJB Query Language (EJB QL)
  • JAX-RPC based web services: endpoints and client views

1.3. Enterprise Beans

Enterprise beans are written as Java classes and annotated with the appropriate Jakarta Enterprise Beans annotations. They can be deployed to the application server in their own archive (a JAR file) or be deployed as part of a Jakarta EE application. The application server manages the lifecycle of each enterprise bean and provides services to them such as security, transactions and concurrency management.

An enterprise bean can also define any number of business interfaces. Business interfaces provide greater control over which of the bean’s methods are available to clients and can also allow access to clients running in remote JVMs.

There are three types of enterprise beans: session beans, message-driven beans and entity beans.

Note

JBoss EAP does not support entity beans.

1.3.1. Writing Enterprise Beans

Enterprise beans are packaged and deployed in Java archive (JAR) files. You can deploy an enterprise bean JAR file to your application server, or include it in an enterprise archive (EAR) file and deploy it with that application. You can also deploy enterprise beans in a web archive (WAR) file alongside a web application.

1.4. Enterprise Bean Business Interfaces

A Jakarta Enterprise Beans business interface is a Java interface written by the bean developer which provides declarations of the public methods of a session bean that are available for clients. Session beans can implement any number of interfaces, including none (a no-interface bean).

Business interfaces can be declared as local or remote interfaces, but not both.

Jakarta Enterprise Beans Local Business Interfaces

A Jakarta Enterprise Beans local business interface declares the methods which are available when the bean and the client are in the same JVM. When a session bean implements a local business interface only the methods declared in that interface will be available to clients.

Jakarta Enterprise Beans Remote Business Interfaces

A Jakarta Enterprise Beans remote business interface declares the methods which are available to remote clients. Remote access to a session bean that implements a remote interface is automatically provided by the Jakarta Enterprise Beans container.

A remote client is any client running in a different JVM and can include desktop applications as well as web applications, services, and enterprise beans deployed to a different application server.

Local clients can access the methods exposed by a remote business interface.

Jakarta Enterprise Beans No-interface Beans

A session bean that does not implement any business interfaces is called a no-interface bean. All of the public methods of no-interface beans are accessible to local clients.

A session bean that implements a business interface can also be written to expose a no-interface view.

1.5. Legacy EJB Client Compatibility

JBoss EAP provides the Jakarta Enterprise Beans client library as the primary API to invoke remote Jakarta Enterprise Beans components.

Starting with JBoss EAP 7.1, two Enterprise Beans clients are shipped:

  • Enterprise Beans client: The regular Enterprise Beans client is not fully backward compatible.
  • Legacy EJB client: The legacy EJB client provides binary backward compatibility. This legacy EJB client can run with the client applications that were initially compiled using the EJB client from JBoss EAP 7.0. All the APIs that were present in the EJB client for JBoss EAP 7.0 are present in the legacy EJB client for JBoss EAP 7.4.

You can use the legacy EJB client compatibility by including the following Maven dependency in your configuration.

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.eap</groupId>
            <artifactId>wildfly-ejb-client-legacy-bom</artifactId>
            <version>EAP_BOM_VERSION</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.jboss</groupId>
        <artifactId>jboss-ejb-client-legacy</artifactId>
    </dependency>
</dependencies>

You must use the EAP_BOM_VERSION that is available in the JBoss EAP Maven repository.