Several extensions described above require the specification of a SQL type (extension sql-type ). This is used to identify the correct SQL type for a field if the database does not provide this information. In most cases Signsoft intelliBO can try to determine the type automatically. But in some cases Signsoft intelliBO has to create tables automatically and needs the correct SQL type to do that.
The SQL type itself may be a string or an integer value.
The string names are the same names as defined in the class java.sql.Types . Currently supported string values for the SQL type in Signsoft intelliBO are: BIGINT, BINARY, BIT, BLOB, BOOLEAN, CHAR, CLOB, DATE, DECIMAL, DISTINCT, DOUBLE, FLOAT, INTEGER, LONGVARBINARY, LONGVARCHAR, NULL, NUMERIC, REAL, ROWID, SMALLINT, TIME, TIMESTAMP, TINYINT, VARBINARY, VARCHAR.
...
<field name="birthday" default-fetch-group="false">
<extension key="jdbc" vendor-name="ssibo">
<extension key="mapping" value="direct" vendor-name="ssibo">
<extension key="field-name" value="BIRTHDAY" vendor-name="ssibo"/>
<extension key="sql-type" value="DATE" vendor-name="ssibo"/>
</extension>
</extension>
</field>
...
The second option is to use integer values to define the SQL type. This enables you to specify an SQL type that is unknown to Signsoft intelliBO but known to your database.
The SQL type extension may have some nested extensions. These are only regarded if you do not want to create your database yourself, but instead use the Schema Generator to build database tables corresponding to your objects. These extensions are described in the tool documentation of the Schema generator.
BLOB and CLOB fields can be mapped using a field mapping. Note that an explicit type definition of the database field has to be provided (see sql-type ).
We assume a class Person with an attribute largeText :
public Person
{
private String largeText;
. . .
}
The belonging part in the JDO file would look like this:
...
<field name="largeText" default-fetch-group="false">
<extension key="jdbc" vendor-name="ssibo">
<extension key="mapping" value="direct" vendor-name="ssibo">
<extension key="field-name" value="LARGETEXT" vendor-name="ssibo"/>
<extension key="sql-type" value="CLOB" vendor-name="ssibo"/>
</extension>
</extension>
</field>
...
The Java type for the attribute can be defined as shown below:
| Column type | Java type | SQL type |
|---|---|---|
| CLOB | String | CLOB |
| byte | ||
| java.sql.Clob | ||
| java.io.InputStream | ||
| BLOB | byte | BLOB |
| java.sql.Blob | ||
| java.io.InputStream |
Note: When a field mapping with types CLOB or BLOB is used, the verifier sometimes generates a warning. The details explain, that the specified field type from the JDO does not map to the field type used in the table. This warning can be ignored because some JDBC driver returned an incorrect sql type or Types.OTHER when querying the metadata information.