|
Introduction
The goal of Enterprise
JavaBeans (EJB) 3.0 is to simplify development of Java applications
and standardize the persistence API for the Java platform. EJB 3.0 is
part of the
Java EE
5.0. EJB 3.0 was worked under Java Specification Request 220 (JSR-220)
in the Java Community Process (JCP). Oracle was a co-lead of the specification and provided the reference implementation for EJB 3.0 Java Persistence API. Oracle TopLink Essentials is the open sourced and community version of Oracle TopLink and is the reference implementation for Java Persistence API.
EJB 3.0
specification was finalized in May 2006 and Oracle has implemented the full support for EJB 3.0 support in Oracle
Application Server 10g (10.1.3.1) . TopLink Essentials is the basis for JPA Support in Oracle Application Server 10g 10.1.3.1.
In Oracle
Application Server 10g 10.1.3.1 , Oracle has implemented most
of the major features of EJB 3.0 final specification. This
container
is available for download and trial on the Oracle
Technology Network. Additionally Oracle adds some value add proprietary features to make application development easier.
Key Features in Oracle Application Server 10g (10.1.3.1)
Simplified API
A key design goal of EJB 3.0 is to simplify the developer experience.
In earlier versions of EJB developers frequently found difficulty working
with extensive APIs and complex deployment descriptors. Oracle
Application Server 10g (10.1.3.1) provides a full implementation
of the simplified model defined by EJB 3.0 Public Draft.
- Simplified EJB
EJB 3.0 eliminates the need for home and component interfaces and
the requirement for bean classes for implementing javax.ejb.EnterpriseBean
interfaces. The EJB bean class can be a pure Java class often referred
as POJO and the interface can be a simple business interface. The bean
class can implement the business interface.
- Use of Annotations Instead of Deployment Descriptors
Metadata annotation is being used as an alternative to deployment descriptors.
Annotations can be used to specify bean types, different attributes
such as transaction or security settings, O-R mapping and injection
of environment or resource references. Deployment descriptor can be
used to override metadata annotations.
- Dependency Injection
The API for lookup and usage of EJB environment and resource references
is being simplified and dependency injection is being used instead.
Metadata annotation is being used for dependency injection.
- Enhanced Lifecycle Methods and Callback Listener Classes
Unlike previous versions of EJB, the bean developers do not have implement
all unnecessary callback methods but can designate any arbitrary method
as a callback method to receive notifications for life cycle events.
A callback listener class may also be used instead of callback methods
being defined in the same bean class.
- Interceptors
An interceptor is a method that intercepts a business method invocation.
An interceptor method may be defined in a Stateless Session Bean, Stateful
Session Bean or an Message Driven Bean. An interceptor class may also
be used instead of defining the interceptor method in the bean class.
- Simple JNDI lookup of EJB
Lookup of EJB has been simplified and clients do not have to create
a bean instance by invoking create method on EJB and can directly invoke
a method on the EJB.
Session Beans
- Simplified Session Bean
Session Beans are pure Java classes and do not have to implement javax.ejb.SessionBean
interfaces. The home interface is optional. A session bean may either
have a remote, local or both interfaces and these interfaces do not
have to extend EJBObject or EJBLocalObject.
- Metadata Annotations
Metadata annotations are used to specify the bean or interface and
run time properties of session beans. For example, a Session bean is
marked with @Stateless or @Stateful
to specify the bean type. Oracle
Application Server 10g 10.1.3.1 has comprehensive support of
metadata annotations for session beans as specified in the EJB 3.0 final
specification.
- Enhanced Lifecycle methods and call back listeners
Callback listeners are supported with both Stateful and Stateless Session
beans. These callback methods can be either specified using Annotations
or deployment descriptor.
- Dependency Injection
Dependency injection may be used either from a stateful or stateless
session beans. Developers can use either metadata annotations or deployment
descriptors to inject resources, EJB context or environment entries.
- Interceptors
Interceptor methods or interceptor classes are supported with both
Stateful and Stateless session beans at bean and method level. Also default interceptors are supported using deployment descriptor element.
Message Driven Beans
- Simplified MDB
Message Driven Beans do not have to implement javax.ejb.MessageDriven
interface and they implement javax.jms.MessageListener interface.
- Metadata Annotations
Metadata annotation is used to specify the bean or interface and run
time properties of MDBs. For example, a MDB is marked with @MessageDriven
for specifying the bean type.
- Enhanced Lifecycle Methods and Call Back Listeners
Callback listeners are supported with MDBs. These callback methods
can be either specified using annotations or deployment descriptor.
- Dependency Injection
Dependency injection may be used from an MDB. Developer either use
a metadata annotation or deployment descriptors to inject resources,
EJB context or environment entries used by an MDB.
- Interceptors
Interceptor methods or interceptor classes can be used with MDBs.
EJB3 Java Persistence API
- Simplified Entity Beans (POJO Persistence)
EJB 3.0 greatly simplifies entities and standardizes POJO persistence
model. Entity Beans are concrete Java classes and do not require any
interfaces. The entity bean classes support polymorphism and inheritance.
Entities can have different types of relationships and container managed
relationships are manually managed by developers.
- Entity Manager API
EJB 3.0 introduces EntityManager API that is used to create, find,
remove and update entities.
The EntityManager API introduces the concept of detachment/merging
of entity bean instances similar to Value Object Pattern. An bean instance
may be detached and may be updated by a client locally and then sent
back to the EntityManager to be merged/synchronized with the database.
Oracle
Application Server 10g 10.1.3.1 has comprehensive support of
EntityManager API both inside and outside the EJB container.
- Metadata Annotations
Metadata annotations greatly simplify development of entities by removing
the requirement of deployment descriptors. The Entity annotation is
used to specify a class to be an entity bean. Annotations are used to
specify transaction attributes, security permissions, callback listeners
and annotated queries.
Oracle
Application Server 10g 10.1.3.1 supports O-R mapping specified
using metadata annotations.
- Query Language Enhancements
EJB 3.0 greatly improves the query capability for entities. It enhances
EJB-QL by additional additional operations such as bulk updates and
deletes, JOIN operations, GROUP BY HAVING, projection and sub-queries.
Also dynamic queries can be written using EJB QL. Oracle
Application Server 10g 10.1.3.1 supports most enhancements of
query language.
- Enhanced Lifecycle Methods and Call Back Listeners
Callback listeners are supported with entities. These callback
methods can be either specified using Annotations or deployment descriptor.
- Usability Outside the Container
The EJB 3.0 persistence engine of Oracle
Application Server 10g 10.1.3.1 can be used outside
container.
Feature List of EJB 3.0 Available in Oracle Application Server 10g 10.1.3.1
Session Beans
- POJO bean class - No requirement for implementing javax.ejb.SessionBean interfaces
- POJI interface - No requirement for extending javax.ejb.EJBObject or javax.ejb.EJBLocalObject interfaces
- Optional Home interface
- Metadata Annotations
- Simplified Exception Handling
- Dependency Injection for EJBContext, Resources and environment references
- Enhanced lifecycle methods
- Interceptor methods and classes (default, bean and method level)
- Step wise migration for EJB 2.1 Session Beans to EJB 3.0
- JDK 1.4 support with XML deployment descriptors
- Oracle specific Annotations for deployment settings
|
EJB 3.0 JPA
- Fully compatible and passed CTS
- Light weight persistence model
- No component interfaces
- EntityManager API
- Metadata Annotations for O-R Mapping
- XML for O-R Mapping
- Default Mappings
- Query Language enhancements (Bulk update, named parameter, native query, etc.)
- Callback Listeners
- Outside J2EE container
- Value-added extentions
- Spring Integration
|
Message Driven Beans
- POJO bean class - No requirement for implementing javax.ejb.MessageDriven interfaces
- Metadata Annotations
- Dependency Injection for EJBContext, Resources and environment references
- Enhanced lifecycle methods
- JDK 1.4 support with XML deployment descriptors
- Oracle specific Annotations for deployment settings
|
|
Top of Page
Summary
EJB 3.0 simplifies the J2EE component programming model and standardizes
POJO persistence model for J2EE. Oracle
Application Server 10g 10.1.3.1 provides one of the industry's
first comprehensive and production-ready EJB 3.0 implementations.
|