This documentation is not maintained. Please refer to doc.castsoftware.com/technologies to find the latest updates.

Summary: this page provides an explanation of the EJB 3.x Framework.

What is EJB 3.x?

EJB is a server-side model that encapsulates the business logic of an application. The EJB specification intends to provide a standard way to implement the back-end 'business' code typically found in enterprise applications (as opposed to 'front-end' user-interface code). Such code was frequently found to reproduce the same types of problems, and it was found that solutions to these problems are often repeatedly re-implemented by programmers. Enterprise JavaBeans were intended to handle such common concerns as persistence, transactional integrity, and security in a standard way, leaving programmers free to concentrate on the particular problem at hand.

Application or Analysis Unit setup

Environment Profile

By default, the analyzer will assume that EJB 3.x is used in the application source code and will automatically apply this environment profile.


NOTE:

  • You will have to add required JAR files in the classpath of your Analysis Unit or Application.
  • This profile handles only the EJB Session and Message Driven Bean. If you want to handle a JPA implementation other than Hibernate 3.2, then you can duplicate the Hibernate 3.2 profile, remove all annotations that are related to Hibernate only (annotations that begin with "org.hibernate." and select the custom profile in your JEE Analysis Unit or in Application.

XML files and Annotations

XML Files

In the JEE Application or Analysis Unit configuration, you need to select an XML directory that contains EJB 3.x Configuration files. EJB 3.x XML file is usually named ejb-jar.xml and refers to the EJB 3.0 xsd:

<?xml version="1.0"?>
<ejb-jar
   xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
   http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
   version="3.0">

Annotations

Some of the EJB 3.x annotations are managed through this Environment Profile. Remaining annotations will be handled in future releases.

EJB 3.x restitution sample

  • A Session Bean named "StatefulBean" is created from the annotation @Stateful
  • The Session Bean has a prototype link to the implementation class StatefulBean
  • Each method of the Remote and Local interfaces have a fire link to the related method of the implementation class, as such, this may trigger violations for rules such as Avoid cyclical calls and inheritances between packages. If this is the case, and you do not want the violations to contribute, you can exclude the objects involved in the CAST Engineering Dashboard, seeĀ Engineering Dashboard - Exclusions.