Using Criteria API in DayTraderPage edited by Dianne Richards
Comment:
Added more documentation
Changes (3)
Full ContentUsing Criteria API in DayTraderA current DayTrader project implementation in Apache Geronimo contains several JPQL queries. These can easily be converted to JPA Criteria API queries. A sample with this conversion can be created to run on the Apache Geronimo server. Downloading DayTraderYou must have Subversion installed in order to download the DayTrader implementation.Subversion can be downloaded from http://subversion.apache.org/packages.html. Use the 2.1.3 version of DayTrader for this sample. Follow the following steps:
Build DayTraderYou must have maven installed in order to build DayTrader. Maven can be downloaded from http://maven.apache.org/download.html. Unzip the file to a directory and run mvn.bat|.sh in the bin subdirectory to install. Add the bin subdirectory to you system path. Maven needs a repository. Typically it is at the following:
From the DayTrader/branches/2.1.3 directory, type "mvn clean install" to build the project. Setting up EclipseFirst install eclipse by going to http:/www.eclipse.org and downloading a version of it. These instructions assume version 3.5. Unzip the downloaded file into a directory. You can start eclipse by running eclipse.exe in the eclipse directory. Next install subclipse, the Subversion Eclipse Plugin:
Generate eclipse files for the DayTrader project. From the DayTrader/branches/2.1.3 directory, type "mvn eclipse:eclipse" Set the M2_REPO classpath variable in Eclipse:
Import DayTrader projects into Eclipse.
Apply the DayTrader PatchThe following patch can be applied using a system or downloaded patch utility. (For example, you can get a patch utility for Windows from http://gnuwin32.sourceforge.net/packages/patch.htm.) Download this patch and go to the DayTrader/branches.2.1.3 directory to apply it. For example, with the patch utility mentioned above, you can type: patch -p0 -i <path-to>/daytrader_geronimo.patch After you have applied the patch, you can see the changes from JPQL to the Criteria API in the java class org.apache.geronimo.samples.daytrader.ejb3.TradeSLSBBean. The changes are in the following 4 methods:
(Note: If you view these changes in eclipse, and you have previously run "mvn eclipse:eclipse" to setup eclipse projects, you'll have to run this command again in order for this file to compile.) Run DayTrader on GeronimoThis writeup assumes some familiarity with Apache Geronimo. The download and documentation can be found at http://geronimo.apache.org. Install and start the Geronimo server Add jpa2 plugins from repository http://geronimo.apache.org/plugins/openjpa2. One way to do this is the following:
Deploy the DayTrader application. This can be done through the console as follows:
Re-start the server. Make sure that the system module, org.apache.geronimo.configs/axis-deployer/2.1.5/car, is running. Run DayTrader:
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] OpenJPA > Using Criteria API in DayTrader confluence
- [CONF] OpenJPA > Using Criteria API in DayTrader confluence
- [CONF] OpenJPA > Using Criteria API in DayTrader confluence
- [CONF] OpenJPA > Using Criteria API in DayTrader confluence
- [CONF] OpenJPA > Using Criteria API in DayTrader confluence
- [CONF] OpenJPA > Using Criteria API in DayTrader confluence
- [CONF] OpenJPA > Using Criteria API in DayTrader confluence
- [CONF] OpenJPA > Using Criteria API in DayTrader confluence
- [CONF] OpenJPA > Using Criteria API in DayTrader confluence
