EJB Tutorials
In this detailed Resource page, we feature an abundance of EJB Tutorials!
Enterprise JavaBeans (EJB) is one of several Java APIs for modular construction of enterprise software. EJB is a server-side software component that encapsulates business logic of an application. An EJB web container provides a runtime environment for web related software components, including computer security, Java servlet lifecycle management, transaction processing, and other web services. The EJB specification is a subset of the Java EE specification.
Specification
The EJB specification intends to provide a standard way to implement the server-side (also called “back-end”) ‘business’ software typically found in enterprise applications (as opposed to ‘front-end’ user interface software). Such machine code addresses the same types of problems, and solutions to these problems are often repeatedly re-implemented by programmers. Enterprise JavaBeans is intended to handle such common concerns as persistence, transactional integrity, and security in a standard way, leaving programmers free to concentrate on the particular parts of the enterprise software at hand.
General responsibilities
The EJB specification details how an application server provides the following responsibilities:
- Transaction processing
- Integration with the persistence services offered by the Java Persistence API (JPA)
- Concurrency control
- Event-driven programming using Java Message Service and Java EE Connector Architecture
- Asynchronous method invocation
- Job scheduling
- Naming and directory services (JNDI)
- Interprocess Communication using RMI-IIOP and Web services
- Security (Java Cryptography Extension and Java Authentication and Authorization Service)
- Deployment of software components in an application server
Additionally, the Enterprise JavaBean specification defines the roles played by the EJB container and the EJBs as well as how to deploy the EJBs in a container. Note that the current EJB 3.2 specification does not detail how an application server provides persistence (a task delegated to the JPA specification), but instead details how business logic can easily integrate with the persistence services offered by the application server.
If you wish to build up your EJB knowledge first, check out our EJB Timer Service Example.
EJB Tutorials – Getting Started
Simple examples based on the JavaBeans
- Expose EJB as a Web Service
With this example we are going to demonstrate how to expose an EJB as a web service. - Reference EJB in another EJB of different applications
This is an example of how to create a reference of an EJB in another EJB of different applications. - Reference EJB in another EJB of the same application
In this example we shall show you how to get a reference of an EJB in another EJB of the same application. - Bean managed Transactions
With this example we are going to demonstrate how to handle bean managed transactions using EJBs. - Use Timer service example
This is an example of how to use thejavax.ejb.TimerService
in an EJB - Stateful Session Bean to persist Entity
In this example we shall show you how to use a Stateful Session Bean to persist an Entity. - Simple Stateless Session Bean example
With this example we are going to demonstrate how to create a simple Stateless Session Bean. - Java EE Stateful Session Bean (EJB) example
In this article we are going to see how you can use Stateful Session Beans to keep track of state across a client Session in a simple Web Application. - Java EE EJB Interceptors tutorial and example
In this example we are going to see how to use Interceptors in an EJB and test it using a simple Web Application. - EJB passivation and activation example
In this tutorial we are going to see how activation and passivation works in a Stateful Java Enterprise Session Bean.
EJB Tutorials – Integrations
Learn how to use JavaBeans with other frameworks
Spring
- Spring 3 Hello World Example
This is an example of how to create a simple Hello World Bean in Spring 3.2.3. The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications – on any kind of deployment platform. - Spring Bean Life-Cycle Example
This tutorial will explore these callback interfaces to briefly understand the initialization and destruction process in the spring framework. - Spring p-namespace Example
This post defines the implementation of the p-namespace in the spring framework and helps developers understand the basic configuration required to achieve this. - Spring Prototype Bean Scope Example
In this article we are going to demonstrate how to properly integrate GWT and EJB3 in order to implement an example project, build it using maven and deploy it on JBoss 5.1 application server. - Spring Singleton Bean Scope Example
This post defines the different bean scopes provided by the spring framework and how to effectively use and manage the singleton scope in a spring application. - Spring @Autowired Annotation Example
This post defines the @Autowired in the spring framework and helps developers understand the basic configuration required to achieve this. - Spring Beans Autowiring Example
This post defines the different bean autowiring scopes in the spring framework and helps developers understand the basic configuration required to achieve this. - Spring Bean Configuration Inheritance Example
This is a tutorial about the Configuration Inheritance between Spring Beans. In Spring, a bean definition can contain a lot of configuration information. - Spring Collections (List, Set, Map and Properties) Example
With this example we shall show you how to inject Collections in Spring Beans properties. The types of Collections that are supported by Spring are List, Set, Map and Properties. - Spring 3 Java Config @Import Example
In this example we shall show you how to use Spring 3.2.3 Java Configuration, and specifically the @Import annotation. Using Java Configuation, we can define beans and configure Spring without using XML configuration files. - Spring 3 Scheduler Example – JDK Timer and Quartz Showcase
In this tutorial we shall show you how to implement a JDK Timer Scheduler example in Spring and then we will enrich the example, using the Quartz Scheduler. - Spring Object to XML Mapper
With this tutorial we shall show you how to convert Objects to xml and vice versa, using Spring’s Object/XML Mapping support. Object/XML Mapping, or O/X mapping for short, is the act of converting an XML document to and from an object. - Spring @Required Annotation Example
This post defines the @Required annotation in the spring framework and helps developers understand the basic configuration required to achieve this. - Spring Autowire Example
In this example we shall show you how to use Spring Autowiring features to wire beans in other beans. The Spring container can autowire relationships between collaborating beans. - Spring Bean Lifecycle Example
With this tutorial we shall show you how to use Spring’s initialization and destruction methods to control a Spring Bean’s lifecycle. - Spring Dependency Checking Example
This is an example of how to check dependencies in a Spring Bean. A Spring Bean can have dependencies of any type, such as primitive types, Collections or even Objects that are references to other beans. - Spring PropertyPlaceholderConfigurer Example
With this tutorial we are going to demonstrate how to use the PropertyPlaceholderConfigurer. The PropertyPlaceholderConfigurer is a property resource configurer that resolves placeholders in bean property values of context definitions. - Spring ListFactoryBean, SetFactoryBean and MapFactoryBean Example
This is an example of how ListFactoryBean, SetFactoryBean and MapFactoryBean classes can be used to instantiate Lists, Sets and Maps and inject them as properties in a Spring Bean. - Spring Inject Date into Bean property with CustomDateEditor
In this example we shall show you how to inject a Date property in a Spring Bean, using the CustomDateEditor. The CustomDateEditor is a class provided by the Spring API and is used as a Property editor for java.util.Date, supporting a custom java.text.DateFormat. - Spring Bean Scopes Example
In this example we are going to demonstrate the types of Bean scopes provided by Spring 3.2.3. In Spring a Bean definition is a recipe for creating actual instances of the class defined. The scope of the objects created by a bean definition can be chosen through configuration. - Spring Inner Bean Example
This is an example of how to use an inner Bean definition inside a Bean. In Spring 3.2.3, when a bean is only used as a property of another bean it can be declared as an inner bean. - How to inject value into Bean properties in Spring
With this example we shall show you how to inject values to Spring Beans properties. Spring’s XML-based configuration metadata supports sub-element types within its <property/> elements for this purpose. - Spring 3 Bean Reference Example
With this example we shall show you how to create bean references, using either annotations or xml configuration in Spring 3.2.3. In Spring, a bean can have references to other beans. - Spring 3 Dependency Injection via Constructor and Setter
In this tutorial we are going to demonstrate the Spring Framework implementation of the Inversion of Control (IoC) principle, that is also known as Dependency Injection (DI). - Spring 3 Java Config @Import Example
In this example we shall show you how to use Spring 3.2.3 Java Configuration, and specifically the @Import annotation. Using Java Configuration, we can define beans and configure Spring without using XML configuration files. - Spring 3 Java Config Example
With this example we are going to demonstrate how to use Spring 3.2.3 Java Configuration. Java Configuration provides a pure-Java means of configuring the Spring container. - Declare bean in Spring container
With this example we are going to demonstrate how to declare a Bean in the Spring container. A Spring bean is an object that is instantiated, assembled, and otherwise managed by a Spring IoC container.
GWT
- GWT EJB3 Maven JBoss 5.1 integration tutorial
In this article we are going to demonstrate how to properly integrate GWT and EJB3 in order to implement an example project, build it using maven and deploy it on JBoss 5.1 application server.
[undereg]