Book Image

EJB 3.1 Cookbook

By : Richard M. Reese
Book Image

EJB 3.1 Cookbook

By: Richard M. Reese

Overview of this book

<p>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.<br /><br />This EJB 3.1 Cookbook addresses all these challenges and covers new 3.1 features, along with explanations of useful retained features from earlier 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 learn those features of interest to you.<br /><br />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. <br /><br />The EJB 3.1 CookBook is a very straightforward and rewarding source of techniques supporting Java EE applications.</p>
Table of Contents (19 chapters)
EJB 3.1 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Exception handling and EJBs


Exception handling is essential to any robust application. Understanding what constitutes a good exception handling technique is important in creating robust applications. In this recipe, we will examine several of these techniques, and see how we can apply them to Java EE applications.

Knowing where to handle exceptions is the key to the proper use of exception handling. The organization of the exception handling code is dependent upon the structure of the application. Exception handling can be viewed from a development and a production standpoint, both of which are important.

When an exception occurs in an EJB that it cannot recover from, it is typically wrapped in an EJBException and then thrown to the caller.

Getting ready

Exceptions are not something we want to avoid, but rather we should embrace them as another tool in our arsenal to create good applications. Exceptions will occur. They may be the result of user input, system problems such as a network being...