|
Sun GlassFish Enterprise Server |
This sample demonstrates the use of Criteria Queries.
The application is exact copy of the advanced mapping sample. The only difference being the queries are written using Criteria API.
The application is built and deployed as a WAR file.
The web module consists of:
A session bean that acts as a facade to operate on these entities. Methods queryForOrderContainingItem and queryDataForOrder demonstrates how to use Criteria Query to query data.
A servlet that facilitates calling into above session bean
The Test client consist of
A Java SE client with main(). The client calls into the servlet to create and query data.
Perform the following steps to build, deploy, and run the
application:
app_dir  is the sample application base
directory: samples_install_dir/javaee6/jpa/criteriaQuery.Change directory to app_dir.
all
target.app_dir> ant
all
You can replace the ant all command with the
following set of
commands:
app_dir> ant
default compiles and packages the application
app_dir> ant
deploy deploys it to application server
app_dir> ant
run runs the test java client
app_dir> ant
clean
Perform the following steps to build, deploy, and run the application using NetBeans IDE:
samples_install_dir/javaee6/jpa/ directory, select criteriaQuery, and click Open Project.criteriaQuery and select Run to build, deploy, and run the project.If you have problems when running the application, refer the troubleshooting document.
Copyright © 2009 Sun Microsystems, Inc. All rights reserved.