Chapter WORKBOOK 7. Exercises for Chapter 9
chapter-9 of the EJB book
introduced you to the javax.persistence.Query
interface as well as the intricacies of EJB
QL. The exercises in this chapter explore the Query API and provide examples of base EJB QL features.
Exercise 9.1: Query and EJB QL Basics
This exercise is made up of several example programs to illustrate the Query API and the basic features of EJB QL. The example programs run outside of the application server, so there is no need to start up JBoss.
Initialize the Database
The standalone Java Persistence solution initializes the Hypersonic SQL database and generates the database schema each time one of the sample programs is run. This is an in-memory database, so you will not see any files created for the database.
Build the Example Programs
Perform the following steps:
Open a command prompt or shell terminal and change to the ex09_1 directory created by the extraction process.
Set the
JAVA_HOME
andJBOSS_HOME
environment variables to point to where your JDK and JBoss 4.0 are installed. Examples:- Windows:
C:\workbook\ex09_1> set JAVA_HOME=C:\jdk1.5.0 C:\workbook\ex09_1> set JBOSS_HOME=C:\jboss-4.0.x
- Unix:
$ export JAVA_HOME=/usr/local/jdk1.5.0 $ export JBOSS_HOME=/usr/local/jboss-4.0
Add
ant
to your execution path. Ant is the build utility.- Windows:
C:\workbook\ex09_1> set PATH=..\ant\bin;%PATH%
- Unix:
$ export PATH=../ant/bin:$PATH
Perform the build by typing
ant
.
Example Basics
Each example program starts off in the same way. It creates ...
Get Enterprise JavaBeans 3.0, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.