Chapter 11. Extending Web Applications with Business Logic: Introducing Enterprise Beans


  • EJB Project Template Wizards

  • EJB Module Structure

  • Adding Enterprise Beans, Files, and Libraries to Your EJB Module

  • Adding Business Logic to an Enterprise Bean

  • Adding a Simple Business Method

  • Enterprise Bean Deployment Descriptors

FOR MANY NETBEANS IDE USERS, as well as web application developers, Enterprise JavaBeans (EJB) technology might be new or apparently complex. However, NetBeans IDE provides wizards and other features to make it easy to create enterprise beans and add business methods to them. Once these business methods are implemented (in Java code), they can be called either from other enterprise beans or from a web application's servlets or utility classes.

The benefits of encapsulating application code within EJB business methods are numerous:

  • Enterprise beans support transactions, the mechanisms that manage the concurrent access of shared objects. Transaction settings are declarative, via the deployment descriptor files.

  • Enterprise beans can be used by many clients, across machines or not (remote and/or local access).

  • Enterprise bean business methods can be secured declaratively, without source code modification.

  • Enterprise beans access external resources such as databases, message queues, mail sessions, and web services declaratively via Java Naming and Directory Interface (JNDI) naming. The JNDI naming service enables components to locate other components and resources. To locate a Java Data-base Connectivity (JDBC) resource, for example, an enterprise bean invokes the JNDI lookup method. The JNDI naming service maintains a set of bindings that connects names to objects. The lookup method passes a JNDI name parameter and returns the related object.

See Table 11-1 for a list of all of the enterprise bean types.

Table 11-1. Types of Enterprise Beans

Enterprise Bean Type

Description

Session

Performs a task for a client or implements a web service. A session bean can be stateful for conversation handling between the client (the user of the business logic) and the server, or stateless.

Entity

Represents a business entity object that exists in persistent storage, typically SQL databases (and possibly others).

Message-Driven

Acts as a listener for the Java Message Service API, processing messages asynchronously.




NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net