Summary

In this chapter on EJB session bean instance, we have seen how POJOs can easily be annotated to be either stateful, stateless, or singleton EJB components. A session EJB is essentially the Java component at the other end of the telephone line; they are the end points that perform some useful action of work.

A session bean, is simply the foundation layer to writing business server objects inside a Java EE application server. Session beans are called by EJB client applications. An EJB can be the client of another EJB. EJB are endpoints of invocation. An EJB container manages all EJBs.

There are two ways an EJB client can fundamentally invoke a method in a session bean. The implementation bean may define a remote business interface and annotate it with @javax.ejb.Remote; and/or it may also define a local business interface and annotate it @javax.ejb.Local.

The EJB container determines the lifecycles of the three types of session beans. Stateful session beans are the only type that supports activation and passivation. Java EE is about adding metadata to a simple Java class and then letting the container manage its lifecycle.

In the next two chapters, Chapter 4, Essential Java Persistence API 3.2 and Chapter 5, Object-Relational Mapping with JPA we will go head-first into Java Persistence. The ability to save user content into a database or backing store using object-relational mapping techniques is a crucially important feature.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.123.73