Overview of data types

In the Guidewire data model, a data type is an augmentation of an object property, along three axes:

Axis

Description

Constraint

A data type can restrict the range of allowable values. For example, a String data type can restrict values to a maximum character limit.

Persistence

A data type can specify how PolicyCenter stores a value in the database and in the object layer. For example, one String data type can store values as CLOB (Character Large Object) objects. Another String data type can store values as VARCHAR objects.

Presentation

A data type can specify how the PolicyCenter interface treats a value. For example, a String data type can specify an input mask to use in assisting the user with data entry.

Guidewire stores the definitions for the base configuration data types in *.dti files in the datatypes directory. Each file corresponds to a separate data type, which the file name specifies.

Every data type has an associated Java or Gosu type (defined in the valueType attribute). For example, the associated type for the datetime data type is java.util.Date. Thus, you see the following XML code in the datetime.dti file.

<DataTypeDef xmlns="http://guidewire.com/datatype"
            type="com.guidewire.pl.metadata.datatype2.impl.DateTimeDataTypeDef"
            valueType="java.util.Date">
  ...

In a similar manner, the decimal data type has an associated type of java.math.BigDecimal.

<DataTypeDef xmlns="http://guidewire.com/datatype"
             type="com.guidewire.pl.metadata.datatype2.impl.DecimalDataTypeDef"
             valueType="java.math.BigDecimal">
  ...

Working with data types

In working with data types, you can do the following:

Operation

Description

Customize an existing data type

Modify the data type definition in file datatypes.xml, which you access through Studio. You can modify only a select subset of the base configuration data types.

See Customizing base configuration data types.

Create a new data type

Create a .dti definition file and place it in modules > configuration > config > datatypes. You also need to create Gosu code to manage the data type.

See Define a new data type.

Override the data type on a column

Override the parameterization of the data type on individual columns (fields) on an entity. For example, you can make a VARCHAR column in the base data model use encryption by extending the entity and setting the encryption parameter on a <columnParam> element.

Using data types

You can use any of the data types for data fields (except for those that are internal). This includes data types that are part of the base configuration or data types that you create yourself. If you add a new column to an entity or create a new entity, then you can use any data type that you want for that column. You do this by setting the type attribute on the column. For example:

<extension entityName="Policy">
  <column name="NewCompanyName" type="CompanyName" nullok="true" desc="Name for the new company."/>
</extension>

If you add too many large fields to any one table, you can easily reach the maximum row size of a table. In particular, this is a problem if you add a large number of long text or VARCHAR fields. Have your company database administrator (DBA) determine the maximum row size and increase the page size, if needed.

Guidewire-reserved data types

Guidewire reserves the right to use the following data types exclusively. Guidewire does not support the use of these data types except for its own internal purposes. Do not attempt to create or extend an entity using one of the following data types:

  • foreignkey
  • key
  • typekey
  • typelistkey

Database data types

Guidewire bases its base configuration data types on the following database data types:

  • BIT
  • BLOB
  • CLOB
  • DECIMAL
  • INTEGER
  • TIMESTAMP
  • VARCHAR

Data types and database vendors

It is possible to see both VARCHAR and varchar in the Guidewire documentation. This usage has the following meanings.

All uppercase characters

This refers to database data types generally, for example VARCHAR and CLOB (Character Large Object). Of the supported database vendors, the Oracle (and H2) databases use uppercase data type names, while the SQL Server database uses lowercase data type names. To view the entire set of database data types, consult the database vendor's documentation.

All lowercase characters

This refers to Guidewire data types generally, for example, varchar and text. You can determine the set of Guidewire data types by viewing the names of the data type metadata definition files (*.dti) in config > datatypes.

Defining a data type for a property

Guidewire associates data types with object properties using the following annotation:

gw.datatype.annotation.DataType

The annotation requires you to provide the name of the data type along with any parameters that you want to supply to the data type.

  • You associate a data type with a metadata property by specifying the type attribute on the <column> element.
  • You specify any parameters for the data type with <columnParam> elements, which are children of the <column> element.

Each data type has a value type. You can associate a data type only with a property that has a feature type that matches the data type of the value type. For example, you can only associate a String data type with String properties.

Note: Guidewire PolicyCenter does not enforce this restriction at compile time. (However, PolicyCenter does check for any exception to this restriction at application server start up.) Guidewire permits annotations on any allowed feature, as long as you supply the parameters that the annotation requires. Therefore, you need to be aware of this restriction and enforce it yourself.