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.

Listing 16.1 - Static Generator command line execution<br />

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

The last line in Listing 16.1 shows how to run the Static Generator utility to generate the<br />

SQL statements for the JPASample persistence unit:<br />

wsdb2gen –pu JPASample –url jdbc:db2://localhost:50000/demodb –user<br />

db2admin –pw passw0rd<br />

Upon execution, this command will generate a file consisting of the SQL statements that<br />

reflect the data operations implemented by the persistence unit JPASample.<br />

The generated file will have extension .pdqxml and the name will reflect that of the<br />

persistence unit. In the example described in this section, the filed created has the name<br />

JPASample.pdqxml. The .pdqxml file format is known as the <strong>pureQuery</strong> capture file<br />

format, already described in Chapter 6. This file contains SQL statements that will later be<br />

converted to DB2 packages.<br />

The Static Generator utility created the bind file in the same location of the<br />

persistence.xml file.<br />

16.4.1 Creating and binding the packages<br />

After all the SQL statements have been generated, the next step is to create and bind the<br />

DB2 packages that will contain these same SQL statements.<br />

This step can be achieved using two different methods:<br />

• using the command line based tool <strong>pureQuery</strong> Static Binder<br />

• using the Websphere Application Server V7 administration console<br />

Since the <strong>pureQuery</strong> Static Binder has already been covered on Chapter 7, we will<br />

describe how to generated and bind the packages using the WAS administration console.<br />

Starting with version 7, the WAS admin console provides an option that lets users load and<br />

bind a <strong>pureQuery</strong> bind file. This option is available on the application’s configuration page,<br />

as shown in Figure 16.2 and it provides an intuitive wizard that guides the user through the<br />

binding process.

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

Saved successfully!

Ooh no, something went wrong!