O'Reilly logo

Java Programming with Oracle SQLJ by Jason Price

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.8. Using Enterprise JavaBeans

Enterprise JavaBeans (EJB) is an architecture that specifies how to write distributed Java components, referred to as beans. The beans are stored in an EJB server, which provides a number of services that may be used by the beans. Such services include:

  • Handling database transactions

  • Persistence of object state

  • Security

Because the EJB server handles the complexities of providing services such as these, a bean developer can concentrate on the business logic provided by the bean. The Oracle JServer has the capability to run EJB, and Oracle8i Version 8.1.6 of the JServer implements Version 1.0 of the EJB standard.

This section is not intended to be a rigorous introduction to the complex subject of EJB, but will give you enough information to create an EJB containing SQLJ for the JServer. For a detailed discussion of EJB programming, I recommend the book Enterprise JavaBeans by Richard Monson-Haefel (O'Reilly). In this section, I introduce a simple bean that uses SQLJ to retrieve a row from the customers table, and show how to deploy this bean to the JServer. Finally, a client program will invoke the bean to retrieve a customer record from the customers table and display the retrieved column values for you to see.

6.8.1. Bean Types

Beans come in two types: entity beans and session beans. Entity beans are used to model physical objects, such as a product. Session beans are used to model specific tasks, such as placing an order for a product. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required