Preface

Enterprise Java Beans enable rapid and simplified development of secure and portable applications based on Java technology. Creating and using EJBs can be challenging and rewarding. Among the challenges are learning the EJB technology itself, learning how to use the development environment you have chosen for EJB development, and the testing of the EJBs.

EJB 3.1 Cookbook addresses all these challenges and covers the new 3.1 features, along with an explanation of useful features retained from previous versions. It brings the reader quickly up to speed on how to use EJB 3.1 techniques through the use of step-by-step examples without the need to use multiple incompatible resources. The coverage is concise and to the point, and is organized to allow you to quickly find and master those features of interest to you.

The book starts with coverage of EJB clients. The reader can choose the chapters and recipes which best address his or her specific needs. The newer EJB technologies presented include singleton beans which support application-wide needs and interceptors to permit processing before and after a target method is invoked. Asynchronous invocation of methods and enhancements to the timer service are also covered.

EJB 3.1 Cookbook is a very straightforward and rewarding source of techniques used to support Java EE applications.

What this book covers

Chapter 1, Getting Started With EJBs presents the creation of a few simple EJBs followed by recipes explaining how they can be invoked by a client. Client examples include the use of servlets, JSP, JSF, SE applications, and applets. The use of JNDI and dependency injection is also presented.

Chapter 2, Session Beans talks about the stateless, stateful, and the new singleton session bean. The use of single and multiple singletons is illustrated along with how concurrency can be managed. In addition, examples of how to use asynchronous methods are presented.

Chapter 3, Message-Driven Beans explains how these EJBs provide a useful asynchronous approach for supporting an application. The numerous types of messages that can be sent are illustrated along with typical application scenarios. Access to the message queue is also discussed.

Chapter 4, EJB Persistence covers the creation and use of entities including the use of a facade class. In addition, numerous validation techniques are presented in support of entities.

Chapter 5, Querying Entities using JPQL and the Criteria API covers how to query an underlying data store with emphasis on the use of JPQL and the Criteria API. The use of annotations in support of these queries is illustrated.

Chapter 6, Transaction Processing, covers transaction processing which is central to many EJB supported applications. In this chapter, we examine how this support is provided using both container-managed transactions using annotations, and bean-managed transactions using code. Also, the use of timeouts and exception handling in support of transactions is illustrated.

Chapter 7, EJB Security covers the process of handling security using annotations and using code. The relationship between the support provided by the server and the roles used by an application is examined.

Chapter 8, Interceptors, explains how the interceptors provide a means of moving code that is not central to a business method outside of the method. Here, we learn how to use interceptors to handle a number of different concerns including security and transactions.

Chapter 9, Timer Services, explains how the timer services provide a means of periodically executing a method. We will examine the use of declarative and programmatic timers along with the use of persistent and non-persistent timers.

Chapter 10, Web Services explores how to create and use EJBs with JAX-RS and JAX-WS web services. Also covered is the use of a message-driven bean with a web service.

Chapter 11, Packaging the EJB details the packaging and deployment of EJBs. It covers the class loading process and the use of deployment descriptors for various interceptors such as timers and callbacks. The use of deployment descriptors with transactions and security is also addressed.

Chapter 12, EJB Techniques, examines techniques that are applicable to a variety of EJB technologies in this chapter. These include the use of logging and exception handling as they apply to EJBs. Also presented is how to create your own interceptor and efficient techniques for using strings, time and currency.

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

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