How to create an EJB Startup Service

In this tutorial, we’ll explore how to use the @Startup and @Singleton annotations in Jakarta EE applications. These annotations allow us to initialize components during application startup and ensure that they are available throughout the application’s lifecycle. We’ll cover the basics of each annotation, how to use them together, and provide examples to illustrate their usage.

Read more

How to configure distributed EJB Timers

Do you need to scale your EJB Timers at its bests ? WildFly 27 supports a new mechanism for storing your Timers in a cluster: distributed EJB Timers. In this article we will learn how to configure it in no time.

Read more

How to disable passivation for SFSB in WildFly

When a Stateful Bean is experiencing a period of inactivity, the EJB container maydecide to remove it from memory temporarily. This process is called passivation. Most of thestate of the EJB is saved automatically except for transient fields. When the EJB is restored,the stateless EJB has its original content except for the transient fields. Passivation … Read more

EJB 3 tutorial : Session Beans

Enterprise JavaBeans (EJB) technology is an Enterprise technology for developing business components in a component-based, enterprise Java application. EJB technology is generally viewed as powerful and sophisticated. The technology helps developers build business applications that meet the heavy-duty needs of an enterprise. In particular, applications built using EJB and other Enterprise technologies are secure, scale … Read more

Singleton EJB tutorial

If you need to make sure you are exposing an Enterprise Java  Bean as a Singleton, there is a simple approach which requires adding the @Singleton annotation on your EJB.   As the name implies a javax.ejb.Singleton is a session bean with a guarantee that there is at most one instance in the application. Until … Read more

How to code EJB interceptors like a pro

EJB 3 interceptors provide the bean developer with fine grained control over the method invocation flow. In this tutorial we’ll see how to code server side EJB Interceptors and how to define Global EJB server side interceptors (WildFly 18 or newer). An interceptor is a method that you can interpose in the invocation flow of … Read more

Using Bean Managed Transactions (BMT) in Java EE applications

In a Bean Managed Transaction (BMT), the code in the EJB or Message Driven Bean explicitly marks the boundaries of the transaction. Although beans with container-managed transactions (CMT) require less coding, they have one limitation: When a method is executing, it can be associated with either a single transaction or no transaction at all. If this … Read more

Message Driven Bean example

A Message Driven Bean (MDB) is an asynchronous message consumer. The MDB is invoked by the container as a result of the arrival of a message at the destination that is serviced by the MDB. In this tutorial you will learn how to code a simple MDB and and a Client to interact with.

Read more