How to code EJB Timers like a pro

The EJB Timer Service can build applications that depend on time based services. In this tutorial we will show how you can receive timer notifications on your Session Beans. In order to do that, an EJB needs to register with the Timer service and one of its methods will be called back on a time … Read more

EJB 3 tutorial for Enterprise developers

EJB 3.1 is now available as early draft and brings lots of interesting improvements, making life lots easier for developers. Let’s see five major innovations introduced by EJB 3.1 specifications. EJB 3 top picks EJB 3.0 was designed around the concept of ease of development for users. Now designing an EJB application is much easier … Read more

How to run EJB 2 with JBoss / WildFly ?

EJB 2 Entity beans have been marked as optional since JAVA EE 7. This means that each vendor can opt to include them or not.As far as WildFly / JBoss EAP 7 is concerned, EJB Entity Beans are no longer supported. This means Container Managed Persistence (CMP) and Bean Managed Persistence (BMP) entity beans must … Read more

How to configure MDB properties dynamically

A simple and effective way to configure the MDB properties dynamically with JBoss EAP and WildFly is via System Properties. All you have to do is coding your MDB Properties and then enable Property replacement: import java.util.logging.Logger; import javax.ejb.ActivationConfigProperty; import javax.ejb.MessageDriven; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.TextMessage; @MessageDriven(name = “HelloWorldQueueMDB”, activationConfig = { … Read more

EJB Annotations cheatsheet for JBoss AS or WildFly

There is a vast number of annotations you can use when running EJB applications, spanning from Cache configuration to Clustering and Security. Let’s see them more in detail in this tutorial. Dependency required to build projects using jboss.ejb3 annotations First of all, in order to be able to compile projects using @org.jboss.ejb3 annotations you need … Read more

Testing JPA out of a container

One of the main reasons Enterprise JavaBeans (EJB) has been neglected in recent years is because EJB components can’t be easily unit tested. Fortunately, the EJB 3.0 spec greatly changes the programming model make EJB—primarily entities—usable and testable outside the container. Since we need the EJB 3.0 persistence layer we can use Hibernate or Toplink implementation: for  … Read more

Custom pool configuration for your EJBs on JBoss AS 7/WildFly

Stateless session beans are held in a pool which can be configured at EJB Container level. You can define as many pool configuration as you want and then decide which one to use for your EJB container. One thing which if often requested is to apply some specific settings for a particular EJB. With JBoss … Read more

Reading properties in EJB

One of the most compelling needs of applications is to read initialization properties. If your application is EJB-centric, then a very simple strategy is to read the properties from a File and store them in an EJB Singleton. Here is how to do it. At first here is how our application looks like: DemoApp.war | … Read more