O'Reilly logo

Enterprise JavaBeans, Fourth Edition by Richard Monson-Haefel, Bill Burke, Sacha Labourey

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

Exercise 8.2: Complex EJB QL Statements

The example programs in Exercise 8.2 delve deeper into the complexities of EJB QL. You will learn about arithmetic and logic operators in WHERE clauses as well as other, more complex WHERE-clause constructs. The test programs of this section demonstrate most of the example queries provided in Chapter 8 of the EJB book.

Start Up JBoss

If you already have JBoss running, there is no reason to restart it.

Build and Deploy the Example Programs

Build the examples for this exercise in the ex08_2 directory, following the same procedure as for earlier exercises.

Examine the JBoss-Specific Files

This exercise introduces no new features in JBoss-specific files. If you think you need to, review Exercise 6.1 of this workbook to understand the JBoss-specific files in this example.

Initialize the Database

The database tables for this exercise will automatically be created in JBoss’s default database, HypersonicSQL, when the EJB JAR is deployed, but to initialize all database tables in this example, you must perform the Ant task run.initialize:

C:\workbook\ex08_2>ant run.initialize
Buildfile: build.xml

prepare:

compile:

run.initialize:
   [java] added Bill Burke
   [java] added Sacha Labourey
   [java] added Marc Fleury
   [java] added Jane Swift
   [java] added Nomar Garciaparra
   [java] added Richard Monson-Haefel

As in the preceding exercise, all example business logic is implemented within a stateless session bean—in this case, com.titan.test.Test82Bean—and the database initialization ...

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