Enterprice Java Beans 3

- JavaTouch

- Spring Framework
- JavaTouch EJB3 Tutorial (for  fast track EJB3 development experience in NetBeans)


EJB 3.0 Specification Final Release

This specification defines the new simplified EJB API targeted at ease of development. It also includes the new Java Persistence API for the management of persistence and object/relational mapping with Java EE and Java SE.

Migrate to EJB 3
- Migrate J2EE Applications for EJB 3.0

EJB 3 Resources

- EJB Technical Articles and Tips Home at Sun
- EJB 3 Resources Home at Oracle 
- EJB 3 Resources Home at JBoss
- EJB3 Wiki at JBoss

"You should consider using enterprise beans if your application has any of the following requirements:
# The application must be scalable.
# Transactions must ensure data integrity.
# The application will have a variety of clients."


The Contents of an Enterprise Bean:
# Enterprise bean class: Implements the methods defined in the business interface and any life cycle callback methods.
# Business Interfaces:
The business interface defines the methods implemented by the enterprise bean class.
# Helper classes:
Other classes needed by the enterprise bean class, such as exception and utility classes.

Technical Tips on EJB 3

- Developing Web Services Using EJB 3.0(Mar 2006)
Accessing the Bean Environment in EJB 3.0 Session Beans (Sep 2005)


"A stateless session bean can implement a web service, but other types of enterprise beans cannot."

BOOK- Java Transaction Design Strategies
This book is about how to design an effective transaction management strategy using the transaction models provided by Java-based frameworks such as EJB and Spring. Techniques, best practices, and pitfalls with each transaction model will be described. In addition, transaction design patterns will bring all these concepts and techniques together and describe how to use these models to effectively manage transactions within your EJB or Spring-based Java applications.
- More information and also free download (pdf) from InfoQ

"Under certain circumstances, the EJB container may write a stateful session bean to secondary storage. Therefore, stateless beans may offer better performance than stateful beans, as the act of retrieving a stateful session bean from secondary storage adds latency to bean activation."

"The most visible difference between message-driven beans and session beans is that clients do not access message-driven beans through interfaces.Unlike a session bean, a message-driven bean has only a bean class."


Characteristics of Message-driven beans :
# They execute upon receipt of a single client message.
# They are invoked asynchronously. 
# They are relatively short-lived.
# They do not represent directly shared data in the database, but they can access and update this data.
# They can be transaction-aware.
# They are stateless.


A remote client of an enterprise bean:
#  It can run on a different machine and a different Java virtual machine (JVM) than the enterprise bean it accesses. (It is not required to run on a different JVM.)
#  It can be a web component, an application client, or another enterprise bean.
#  To a remote client, the location of the enterprise bean is transparent.

A local client of an enterprise bean:
# It must run in the same JVM as the enterprise bean it accesses.
# It can be a web component or another enterprise bean.
# To the local client, the location of the enterprise bean it accesses is not transparent.


Enterprise JavaBeans (EJB) technology is the server-side component architecture for Java Platform, Enterprise Edition (Java EE). EJB technology enables rapid and simplified development of distributed, transactional, secure and portable applications based on Java technology.

Naming Conventions for Enterprise Beans:

Item Syntax Example
Enterprise bean name <name>Bean AccountBean
Enterprise bean class <name>Bean AccountBean
Business interface <name> Account

- EJB Home at Sun
- EJB 3.0 Technology Official FAQ from Sun
- Sun EE 5 Tutorial on EJB 3 (Chap 20- Enterprise Beans)
- Sun EE 5 Tutorial on EJB 3 (Chap 21- Getting Started with Enterprise Beans)
- Sun EE 5 Tutorial on EJB 3 (Chap 22- Session Bean Examples)
- Sun EE 5 Tutorial on EJB 3 (Chap 23- A Message-Driven Bean Example )
- EJB 3.0 API Documentation


Tutorials and Articals

- JavaTouch EJB3 Tutorial
- EJB 3.0 Feature Overview (at Jboss)
- EJB 3.0 Preview Part 1: The basic programming model (from JDJ)
- Introduction to Enterprise JavaBeans 3.0 (from Oracle)
Learn about the different types of EJBs, what they offer you, and when to use them
- Simplifying EJB Development with EJB 3.0
- Does EJB 3.0 really make application development easy ?
-EJB 3.0 Feature Overview (at Oracle, artical contains Oracle Application Server specific details as well) 
- Create your first EJB3 application in 30 min (NetBeans 5.5 Tutorial)
The goal of this exercise is to create the NewsApp enterprise application project containing an EJB module and a web module. The NewsApp application uses a message-driven bean to receive and process messages sent to the queue by a servlet. The application uses servlets to send messages to the message-driven bean and to display messages.
- How-To Develop a Stateful Session EJB using EJB 3.0 (Oracle; Jun, 2006). Download Code.. for the tutorial.

- An Introduction to the Enterprise JavaBeans 3.0 (EJB 3) Specification (from DevtoDev)
- First Taste of EJBs - A sample draft chapter from EJB3 In Action.
Learn more about each types of EJB. Co-authored by Debu Panda
- EJB 3 Session Beans  A sample chapter from Beginning EJB 3 Application Development: From Novice to Professional. Authored by Raghu Kodali and Jonathan R. Wetherbee
- EJB 3.0 Preview Part 2: The advanced features (from JDJ)

- Grails + EJB Domain Models Step-by-Step (from InfoQ)
A must-read tutorial showing how to use Grails (Java's Groovy answer to Ruby on Rails) to quickly build a functional website around an existing EJB 3 entity bean domain model with very little code.
- Writing Performant EJB Beans in the Java EE 5 Platform (EJB 3.0) Using Annotations (September 2006 at Sun)
- Enterprise Java Beans for Building Business Process Management Applications (TheServerSide; May 2006)

Webservices and EJB3 in JBoss

Spring, EJB3 and JPA
- How To : Using EJB 3.0 Session beans in Spring Beans (Oracle; Jun, 2006). Download Sample code..
- How To : Using EJB 3.0 and Java Persistence API with Spring in OC4J Oracle; Jun, 2006). Download Sample code..

Sample Codes

- EJB 3 Entity (Bean) sample code (fro JBoss)
- EJB 3 StatelessSessionBean (fro JBoss)
- EJB 3 StatefulSessionBean (fro JBoss) (To be added soon *) Check..
- EJB 3 MessageDrivenBean (fro JBoss)


      Life Cycle of Stateless Session Bean


Tech Talks and Presentations

- Mike Keith on EJB 3 (Feb 14, 2007 from InfoQ)
EJB 3 co-spec lead Mike Keith discusses the current state of EJB 3, including common praises and criticisms that have been received. He also talks about POJO support and how the spec has evolved towards dependency injection. Watch Mike Keith on EJB 3 

Gavin King on Seam (August 28, 2006 from TheServerSide)
In this presentation, given at TheServerSide Java Symposium Barcelona in June, Hibernate founder Gavin King looks at how Seam, a new application framework that integrates the EJB 3.0 component model with JSF as a presentation tier, builds upon the standard extension points provided by both specifications. The discussion includes coverage of Seam's managed conversations, declarative and contextual application state management, and bijection.King also describes how Seam addresses state-related problems that existed with J2EE by providing a uniform model for stateful components in Java EE 5.
Download and listen to Gavin King on Seam. (8.26 MB)

Mike Keith on the EJB3 Persistence API (July 24, 2006 from TheServerSide)
In this talk, given at TheServerSide Java Symposium in March, Oracle's Mike Keith talks about the release of EJB3 and preparations around the release. Keith dispels the two large myths behind EJB3 and explains how EJB3 tackles persistence. Keith also discusses the best ways to prepare for the migration to EJB3.
Other topics include:
- Goals of the EJB3 spec
- The influence of Spring and open source on EJB3
- The flexibility of the Java persistence API
- EJB3's reference implementation
- Vendor compliancy
- Tool development
Watch Mike Keith on the EJB3 Persistence API.

- Advanced EJB3 Persistence talk by Linda Demichiel and Mike Keith
(July 17, 2006 from TheServerSide)
One of the key results of the work on EJB 3.0 has been the introduction of a lightweight POJO persistence model for Java EE. This work on persistence has also been expanded to include use in Java SE environments - i.e. "outside the Java EE container".
This JavaPolis talk (Login required) covers key aspects of the Java Persistence API, including changes since the publication of the JSR 220 Public Draft.
Topics covered include:
* Brief overview of the developer view of the new POJO persistence model
* EntityManager API and entity bean lifecycle
* Persistence units and persistence contexts
* Detached objects vs extended persistence contexts
* Object/Relational Mapping using Java metadata annotations and/or XML
* Query API, and the mapping of query results
* Extending the use of the Persistence API outside of the Java EE container
* Constructs for packaging and deployment
Download and Watch the talk here.

- EJB3 and JDO2 by Patrick Linskey (TheServerSide, 2006)
While SolarMetric CTO Patrick Linskey believes there will always be JDO and EJB, the question lies in where the specs will go over time. In this tech talk, Linskey discusses the EJB/JDO controversy.

- Hibernate3 and EJB3 by Gavin King (TheServerSide, 2006)
According to Gavin King, founder and leader of the Hibernate project, Hibernate3's compatibility with EJB3 allows plugability between persistence vendors, ORM vendors and the EJB3 container. In this tech talk, King discusses how Hibernate3 builds upon and extends EJB3.

- EJB3 by Raghu Kodali, technology evangelist for Oracle (TheServerside; 2006)
According to Raghu Kodali, product manager and evangelist in the application server group at Oracle, EJB 3.0 is addressing its infamous complexities with increased productivity and performance. In this tech talk, Kodali discusses new features of EJB3 and what it all means for developers.


             Life Cycle of Stateful Session Bean


Other EJB 3 Resources

- EJB 3 Glossary (infoQ)


IDE Related Resources

NetBeans IDE
- Java EE Applications Learning Trail
- JavaTouch EJB3 Tutorial

Eclipse IDE
- Starter Skeleton EJB 3 Eclipse Project  (JBoss Specific)

- Introduction to EJB 3.0 Using JDeveloper 10g and OC4J (from Oracle)

EJB Forums

- EJB Forum at SDN
- Java Enterprise Forum at java.net


            Life Cycle of Message-Driven Bean