From Eigenpedia

Jump to: navigation, search

String attributes are stored by Enki/Hibernate using RDBMS text types. When possible, VARCHAR types are used, and as such the UML model must specify the maximum storage requirements for string attributes.


Length to Type Conversion

When using Enki/Hibernate, Hibernate is responsible for determining the column type that will underly a particular string attribute. In some cases, Hibernate uses long text types even though the underlying database may support a VARCHAR of sufficient size. (For example, the Hibernate 3.1 dialect for MySQL converts strings with length 16384 to the TEXT type even though the MySQL version in use supports VARCHAR(16384)).

Default Storage Length

By default, all string attributes are assumed to have a maximum length of 128 characters. The default can be overridden model-wide by specifying the defaultStringLength option when invoking the HibernateGenerator.

Specifying Storage Length Per-Field

To override the storage length for a given string attribute, apply a MOF tag to the attribute with identifier "org.eigenbase.enki.maxLength" and the number of characters of storage to use. The value must be greater than 0. As a special case the value "unlimited" indicates that the database's largest long text type be used. Values less than 32,768 characters use the Hibernate "string" type. Values larger than 32,768 use "text." The overridden storage length applies to the attribute in subclasses as well.

Class-specific Default Storage Length

To override the default storage length for all string attributes in a specific class without effecting super- or subclasses, apply a MOF tag to the class with the identifier "org.eigenbase.enki.maxLength". If a given attribute has a specific storage length specified, it is used.

WARNING: The class-specific default storage length feature is subject to change behavior if additional flexibility is required.

Personal tools