This XML is sample input to the JET transformation
with
the GenSQLBean.jet template.
<?xml version="1.0" encoding="UTF-8"?>
<genCodeData>
<selection genAlwaysJUnit="false" genIncludeConn="false"
genInlineSample="true" genInterface="true" genInterfaceTest="true"
genSampleUtil="false" genType="genFromSQL" />
<connection name="SAMPLE1" />
<sqlStatements>
<interface
importAnnotations="import com.ibm.pdq.annotation.Select;import java.util.Iterator;"
importTypes="" interfaceMerge="false" interfaceName="MyActSQLData"
package="myPackage" srcContainer="MyProject/src" />
<testCode importTypes="import java.util.Iterator;"
inlineSampleName="MyActSQLInlineSample"
interfaceTestName="MyActSQLDataTest" package="myPackage"
srcContainer="MyProject/src" />
<results>
<resultSet>
<bean genBean="true" genPublicFields="false"
importAnnotations="import com.ibm.pdq.annotation.Id;"
importTypes="" name="MyActSQL" package="myPackage"
srcContainer="MyProject/src" superClass="java.lang.Object" />
<fieldInfos>
<field>
<column colLength="" colType="CHAR"
isAlwaysGenCol="false" isIdentityCol="false" isKey="false"
isUniqueColName="true" isUserDefinedType="false" name="ACTDESC"
tableName="ACT" />
<parameter accessor="getActdesc()"
javaType="String" name="actdesc" propertyName="actdesc" />
</field>
<field>
<column colLength="" colType="CHAR"
isAlwaysGenCol="false" isIdentityCol="false" isKey="false"
isUniqueColName="true" isUserDefinedType="false" name="ACTKWD"
tableName="ACT" />
<parameter accessor="getActkwd()"
javaType="String" name="actkwd" propertyName="actkwd" />
</field>
<field>
<column colLength="" colType="CHAR"
isAlwaysGenCol="false" isIdentityCol="false" isKey="true"
isUniqueColName="true" isUserDefinedType="false" name="ACTNO"
tableName="ACT" />
<parameter accessor="getActno()"
javaType="String" name="actno" propertyName="actno" />
</field>
</fieldInfos>
<sql handlerClass="" methodName="getMyActSQL"
sqlStmt="SELECT ACTDESC, ACTKWD, ACTNO FROM ACT WHERE ACTNO = ?"
stmtType="SELECT">
<parameter javaType="String" name="param1" />
</sql>
</resultSet>
</results>
</sqlStatements>
</genCodeData>
- bean
- The attributes of this tag describe the generated bean for a single
result set.
- genBean
- Specifies
whether to create a new bean or whether the bean tag
describes an existing bean.
- true
- Create a new bean.
- false
- The bean tag describes an existing bean.
- genPublicFields
- Specifies the access level of the properties of the bean.
- A
value of true generates the properties of the bean as public.
- A
value of false generates the properties of the bean as protected
and allows access to them through get and set methods.
- importAnnotations
- Specifies
whether to import the pureQuery annotations. Acceptable
values are as follow:
- mport com.ibm.pdq.annotation.Column;
- import com.ibm.pdq.annotation.Table;
- The bean must import the Table annotation if the name of the bean
does not match the name of the corresponding database object.
- The
bean must also import the Column annotation if one or more
names of the properties in the beans do not match their corresponding
columns or parameters in the database object.
- The bean can
import the Id annotation if you want to use that
annotation to show which columns are part of a primary key.
- importTypes
- Specifies
which Java types
to import. You must import all types that are not part of the java.lang.*
package.
- name
- Specifies
the name of the bean.
- package
- Specifies the name of the Java package
in which to place the generated code.
- srcContainer
- Specifies the folder within the project in which to place the
generated code.
- superClass
- Specifies the superclass of the bean.
- column
- The attributes
of this tag describe a column in the database object.
- colLength
- Specifies the length of the
column.
- colType
- Specifies
the data type for the values in the column.
- isAlwaysGenCol
- Specifies whether the values in the column are always generated.
Acceptable values are true and false.
- isIdentityCol
- Specifies
whether the column is an identity column. Acceptable
values are true and false.
- isKey
- Specifies
whether the column is a key column. Acceptable values
are true and false.
- isUniqueColName
- Specifies
whether the column name is unique. Acceptable values
are true and false.
- isUserDefinedType
- Specifies
whether the type of the column is user-defined. Acceptable
values are true and false.
- name
- Specifies the
name of the column.
- tableName
- Specifies the name of the table to which the column belongs.
- connection
- The attribute of this tag specifies the name of the database connection
to use.
- name
- Specifies
the name of the database connection to use.
- field
- The tags within
this tag describe how a particular column in the
database object maps to a particular property of the bean.
- fieldinfos
- The tags
within this tag describe how columns in the database
object map to properties of the bean.
- interface
- importAnnotations
- Specifies
the pureQuery annotations to import into the generated
interface. Acceptable values are as follow:
- import
com.ibm.pdq.annotation.Call;
- import
com.ibm.pdq.annotation.Select;
- import
com.ibm.pdq.annotation.Update;
- import
com.ibm.pdq.annotation.Handler;
- importTypes
- Specifies which Java types
to import. You must import all types that are not part of the java.lang.*
package.
- interfaceMerge
- If the specified name of the interface to generate matches the
name of a Java class that already
exists in the target Java project,
specifies to merge the contents of the existing class with the newly
generated interface.
- interfaceName
- Specifies the name of the interface to generate for the annotated-method
programming style.
- package
- Specifies the name of the Java package
in which to place the generated code.
- srcContainer
- Specifies the folder within the project in which to place the
generated code.
- parameter
- The attributes of this tag describe a particular property of the
bean or a parameter for passing values into an SQL statement
- javaType
- Specifies the Java data
type for the property of the bean or value passed into an SQL statement.
- name
- Specifies the
name of the property or parameter.
- resultSet
- The tags that this
tag contains describe the contents of the generated
bean.
- sql
- The
attribute of this tag describes the wizard that initiates
the code generation.
- handlerClass
- If you want to use your own RowHandler class
for processing the results of the stored procedure, specify the package
and class name. For information about RowHandler classes,
see The RowHandler<ROW> interface
- methodName
- Specifies the name
of the method to generate in the interface.
- sqlStmt
- Specifies the text of the SQL statement.
- stmtType
- Specifies the type of the SQL statement. Valid values are SELECT, UPDATE, DELETE, INSERT,
and CALL.
- testCode
- importTypes
- Specifies which Java types
to import. You must import all types that are not part of the java.lang.*
package.
- inlineSampleName
- Specifies the name to give to the generated test class for the
inline programming style.
- interfaceTestName
- Specifies the name of the test class for the annotated-method
programming style.
- package
- Specifies the name of the Java package
in which to place the generated code.
- srcContainer
- Specifies the folder within the project in which to place the
generated code.