Overview of the pureQuery API

With the pureQuery™ API, you can easily develop, update, and troubleshoot Java™ data access applications. You enable Java applications that use the pureQuery API by including the pureQuery Runtime JAR files in the application classpath and specifying pureQuery Runtime properties.

pureQuery annotated methods and inline methods

The pureQuery API separates business logic from the SQL statements that access data and supports easier maintenance of both application and database access. You can develop data access applications that follow the Data Access Object (DAO) pattern by creating data access objects with annotated methods. The following illustration shows how a DAO interface separates the database access from the business logic.

Figure 1. pureQuery DAO interface with pureQuery annotated methods
DAO interface with pureQuery annotated methods

In Data Studio, when you create interfaces with pureQuery annotated methods, Data Studio generates the implementation classes for interfaces that declare pureQuery annotated methods.

With the pureQuery DAO support, you can easily and quickly develop applications that return beans or lists and arrays of beans. You do not have to create your own JDBC API to use and manipulate returned ResultSet rows and individual columns within each row.

The pureQuery API also supports inline methods to take advantage of the methods that are defined in the IBM-supplied Data interface. Inline methods are useful for applications that require the construction of SQL statements during application run time. With inline methods, SQL statements are passed as parameters in method invocations. An inline method is similar to the approach that is taken in JDBC and SQLJ.

For both DAO patterns and inine methods, the pureQuery API supports ResultSet handlers that are automatically generated and ResultSet handlers that can are manually created.

The pureQuery API application environment

The following illustration shows a typical environment for an application that uses the pureQuery API. The pureQuery Runtime JAR files are in the application class path. The repository contains the pureQuery runtime properties information that pureQuery Runtime uses to control SQL statement execution.

Figure 2. Simple pureQuery API application environment
pureQuery API application environment

The repository is optional. The pureQuery runtime properties can be specified in a properties file in the application environment or as application database connection properties. For example, in a WebSphere® Application server environment, you can specify the runtime properties at the data source, the application level, or the global level.

You can run SQL statements statically from applications that implement interfaces and use pureQuery annotated methods. You perform a bind operation with the Data Studio or with the pureQuery utility StaticBinder. You specify the interfaces that contain the SQL statements that you want to bind and run statically. You can have Data Studio generate the implementation classes for you, or you can generate the implementation classes for the interfaces with the pureQuery utility Generator.


Feedback