At application startup, the SQL repository accesses the database to determine the JDBC type of each property in the repository template. This enables the SQL repository to use the appropriate JDBC type in creating SQL queries. For large database schemas, however, getting the JDBC type of every column in your schema can take an unacceptably long time. If this is a problem, you can solve it in several ways:

Set the sql-type attribute for All Repository Item Properties

You can explicitly set the sql-type or sql-types attribute for every non-transient property in your repository template. These attributes are attributes of the <property> element. For example:

<property name="winning_number" data-type="long" sql-type="numeric" />

If you set the sql-type or sql-types attribute for every non-transient property in your repository template, the SQL repository does not try to check the JDBC type of your properties.

One drawback of this approach is that the sql-type can vary depending on your database software vendor. If you set the sql-type attribute explicitly, you must review and update the value if you move your repository implementation to a different vendor’s database software.

Set the safeSQLTypes Property in the GSARepository Component

The GSARepository class includes a property named safeSQLTypes. This property can be set to a comma-separated list of SQL types for which the repository always uses the default type. You can set this property to string values of SQL types like varchar, or to the corresponding integer values specified in the class java.sql.Types (for example, -4). The default value of this property is empty.

The SQL repository does not try to determine the JDBC types for properties in a database table if every property has its sql-type attribute set explicitly, or is of a type included in the safeSQLTypes property for that repository.

Cache the Schema Information

You can configure the SQL repository to cache information about your repository database schemas. Do this by setting the updateSchemaInfoCache property in the GSARepository component to true. The default value for this property is false. If you set this property to true, after you reassemble, redeploy, and restart your application, the server creates the directory {atg.dynamo.home}/data/schemaInfoCache/. This directory contains a series of files with names like repositoryName.properties, one file for each repository in your application. Each file in the /data/schemaInfoCache directory specifies the SQL type of each column in that repository’s schema, in the following format:

tablename.colname=SQLtype

The SQL type in this case is the integer type code specified in the class java.sql.Types. For example, setting the updateSchemaInfoCache to true in the ProfileAdapterRepository component might generate a file that begins like this:

## SchemaInfoCache - auto generated
#Tue May 13 17:32:25 EDT 2003
dps_user_scenario.scenarioInstances=12
paf_usr_pgfld.creationDate=93
dps_email_address.emailAddresses=12

These files can be generated against one database and copied to another as long as the schemas are compatible. If you change the schema and this property is enabled, you must remove the /data/schemaInfoCache directory so it is regenerated. The /data/schemaInfoCache directory does get regenerated automatically if you add a property that refers to a new column or a new table. If those files exist, they are used even if the updateSchemaInfoCache property is set to false. This enables a live server to use the schema info cache generated by a different staging server. This can be useful if one server in a cluster is unable to generate the schema information.


Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices