16.10.2015 Views

Getting Startedwith pureQuery

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix A – Solutions to the review questions 311<br />

8. Each of the implementation classes implements com.ibm.pdq.runtime.Data,<br />

in addition to the interface of annotated methods. This is helpful because you can<br />

use the methods to manage the java.sql.Connection object that the instance<br />

contains, and to perform transaction management for the SQL statements that the<br />

annotated methods execute.<br />

9. Cast the instance as a com.ibm.pdq.runtime.Data object and call the<br />

close() method in the Data interface.<br />

10. Some of the benefits of using the annotated-methods style are:<br />

A. You can speed-up your application development. All you have to do is<br />

declare methods that specify the SQL statement, the parameters, and the<br />

return type, and the tools take care of the rest of the work.<br />

B. You can use annotated-methods style code to execute SQL statements<br />

statically.<br />

C. The interfaces containing annotated methods help to isolate the SQL<br />

statements from the application code.<br />

11. The user must override the default JET transformation by creating an EMFT JET<br />

project, creating the templates and telling ODS to user your own transformations.<br />

The many different JET templates used by the <strong>pureQuery</strong> tooling are located in the<br />

com.ibm.datatools.javatool.transform.codegen plugin within ODS.<br />

Once you have created your EMFT JET Transformation project and your template<br />

to override one of the default templates provided, go to the <strong>pureQuery</strong> Transforms<br />

preference page and specify which transformation the workbench must use.<br />

Chapter 12<br />

1. You execute stored procedure calls with the call methods in the<br />

com.ibm.pdq.runtime.Data interface.<br />

2. You use the com.ibm.pdq.annotation.Call annotation to have an annotated<br />

method execute a stored procedure call.<br />

3. A and C<br />

4. B and C<br />

5. False<br />

6. B<br />

7. Assume that the name of the StoredProcedureResult object is spr. Use this<br />

code: Integer parm4 = (Integer) spr.getOutputParms()[3]<br />

8. You can call the close() method. Also, if you retrieve all of the query results,<br />

<strong>pureQuery</strong> automatically frees the database resources.

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

Saved successfully!

Ooh no, something went wrong!