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.

138<br />

<strong>Getting</strong> Started with <strong>pureQuery</strong><br />

7.2 Binding from interfaces and <strong>pureQuery</strong>Xml files<br />

You must specify <strong>pureQuery</strong>Xml files or interfaces that contain the SQL statements that<br />

<strong>pureQuery</strong> should bind.<br />

7.2.1 Binding from interfaces<br />

7.2.1.1 Database packages that the StaticBinder utility binds<br />

For static SQL, interfaces of annotated methods represent packages in the database. The<br />

implementation class corresponding to an interface has a root package name. The<br />

StaticBinder utility uses this to determine the names of the packages in the database. The<br />

root package name was specified to the Generator utility by using the -rootPkgName<br />

option, or the Generator utility determined it based on the name of the interface, if the<br />

option was not specified. In the implementation class, the root package name is stored in<br />

the field identifier.<br />

By default, the StaticBinder utility binds four packages in the database for each interface,<br />

one at each of four isolation levels. Also by default, the StaticBinder utility appends 1, 2, 3,<br />

and 4 to the root package name of the interface so that the four packages have distinct<br />

names. The number 1 indicates the isolation level uncommitted read (UR), 2 indicates<br />

cursor stability (CS), 3 indicates read stability (RS), and 4 indicates repeatable read (RR).<br />

If you want the StaticBinder utility to bind only one package for an interface, specify the<br />

option -isolationLevel. If you only want it to bind one package, and you do not want<br />

the 1, 2, 3, or 4 indicator appended to the root package name, specify the option -<br />

forceSingleBindIsolation to the Generator utility when you generate the<br />

implementation class for the interface. The Generator utility needs to store this information<br />

in the implementation class so that during static execution, <strong>pureQuery</strong> knows the names of<br />

the packages. When you bind the interface, specify -isolationLevel so that the<br />

StaticBinder utility will know which isolation level to use.<br />

As an example, suppose that you have an interface with the root package name MYPKG.<br />

Table 7.1 shows some example of the packages that the utility would bind in the database<br />

for certain values of -forceSingleBindIsolation and -isolationLevel. The table<br />

only shows the packages when the option -isolationLevel is either not specified, or is<br />

specified with the value UR. The results follow the same pattern when other values are<br />

specified for -isolationLevel.<br />

Value specified for the<br />

-forceSingleBindIsolation<br />

option to the Generator utility<br />

Value specified for the<br />

-isolationLevel<br />

option to the<br />

StaticBinder utility<br />

Names of<br />

packages bound<br />

in the database

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

Saved successfully!

Ooh no, something went wrong!