16.10.2015 Views

Getting Startedwith pureQuery

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 16 – <strong>pureQuery</strong> and JPA 297<br />

statements, SQL statements are also generated to reflect the JPA named queries that exist<br />

in the application. SQL statements that are dynamically generated by the application<br />

cannot be captured by this utility. For more information on how to capture and optimize<br />

dynamic queries, refer to Chapter 6 - The Client Optimizer: <strong>pureQuery</strong> for Existing JDBC<br />

Applications.<br />

In this chapter, we will use the sample application provided in the IBM developerWorks<br />

article “Integrating JPA and <strong>pureQuery</strong>: Leveraging DB2 static execution for the Java<br />

Persistence API”. In the Resources section of this book you can find a download link for the<br />

JPA_EE_SAMPLE.ear application file.<br />

The provided sample application contains a persistence unit, of name JPASample and<br />

implements functionality that lets the user create, update and delete customer entities, as<br />

well as retrieve information regarding orders.<br />

16.4 Generating SQL statements<br />

Before we describe the parameters of the Static Generator utility, please note that for the<br />

utility to function properly, the following items must be part of the DataProvider classpath<br />

in your WAS environment:<br />

• <strong>pureQuery</strong> runtime .jar files<br />

• DB2 driver .jar files<br />

• the entity class .jar file or folder where it is located<br />

• the location of the persistence.xml file<br />

After you have correctly set up the system classpath, the Static Generator utility can be<br />

invoked by executing the command wsdb2gen.bat, as shown in Listing 16.1.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!