4.2. Class-level Object-Relational Mapping Extensions

4.2.1. table
4.2.2. pk-column
4.2.3. lock-column
4.2.4. class-column
4.2.5. subclass-provider
4.2.6. subclass-indicator-value
4.2.7. custom-mapping
4.2.8. can-cache
4.2.9. data-cache-name
4.2.10. cache-timeout
4.2.11. sequence-factory-class
4.2.12. sequence
4.2.13. sequence-factory-properties

The following keys are recognized for extension elements that are direct children of class elements in the metadata document.

4.2.1. table

This extension specifies the table used to store the primary data for the class. If not specified, Kodo will auto-generate a table name based on the name of the class. This attribute is also used in multi-table inheritance mappings

4.2.2. pk-column

This extension is only for classes using datastore identity. It specifies the primary key column for the table in which the class is held. This column must be of a numeric type and must not be mapped to any fields of the class. If the pk-column extension is not specified and the class being described is a least-derived type, Kodo will add its own primary key column, usually named JDOIDX. If the pk-column extension is unspecified and the class being described extends from another persistence-capable type, then Kodo will use the primary key column name defined by the superclass.

4.2.3. lock-column

This extension specifies the column used to record the version number of objects. Versioning is used to detect concurrent modification of objects during optimistic transactions. The given column must be of a numeric type and must not be mapped to any fields of the class. If the extension is not present, Kodo JDO will add its own lock column, usually named JDOLOCKX. You can prevent the creation of a lock column by specifying a value of none. In this case, concurrent modification violations will not be detected.

4.2.4. class-column

This column stores the class name of the object represented by each table row. The column must be a string type, and must be large enough to hold the full class name of any persistent class mapped to the table. It must not be mapped to any fields of the class. If the extension is not present, Kodo JDO will add its own class column, usually named JDOCLASSX. If the table's corresponding persistent class has no persistent subclasses and you do not want a column to be generated, specify a value of none. If you specify none and try to use Kodo with subclasses, Kodo will throw an exception when it attempts to load data.

4.2.5. subclass-provider

This optional extension stores the name of the SubclassProvider implementation to use for this class. This setting overrides the com.solarmetric.kodo.impl.jdbc.DefaultSubclassProviderClass configuration property.

This should only be set in the least-derived type in an inheritance tree. Values for this extension in derived types are silently ignored.

4.2.6. subclass-indicator-value

When using the IntegerSubclassProvider subclass provider, this required extension must be set to the integer value that the provider should use to identify this class. No two classes in the same class hierarchy can use the same integer value.

4.2.7. custom-mapping

This optional extension stores the name of the ClassMapping subclass to use for this class. This setting overrides the com.solarmetric.kodo.impl.jdbc.DefaultClassMappingClass configuration property.

This should only be set in the least-derived type in an inheritance tree. Values for this extension in derived types are silently ignored.

4.2.8. can-cache

This optional extension designates whether or not a given class should be included in the PersistenceManagerFactory cache, if any. Setting it to false will exclude the class associated with this extension. Defaults to true.

4.2.9. data-cache-name

The name of the cache that will be used to hold instances of this persistent class. See the documentation on specifying a non-default DataCache.

4.2.10. cache-timeout

This optional extension designates the time in seconds that an instance of this class's data is valid for in the the PersistenceManagerFactory cache. Leaving it unset or setting it to a value less than or equal to 0 will disable timeouts for this class. Setting this to a positive decimal value will cause data of this type loaded into the cache to be deemed invalid after cache-timeout seconds have passed. Defaults to 0.

4.2.11. sequence-factory-class

This optional extension configures a custom SequenceFactory for the current persistent type. This is only valid in the least-derived type in an inheritance hierarchy that uses datastore identity. If this extension is unset, the system-wide SequenceFactory specified in the SequenceFactoryClass property will be used.

If the sequence-factory-properties is specified, then the value of that extension will be used when configuring the sequence factory.

4.2.12. sequence

The name of the sequence for generating primary keys. Used in conjunction with the sequence-factory-properties extension.

4.2.13. sequence-factory-properties

This optional extension defines the configuration properties to use when creating a SequenceFactory for this class. See the sequence-factory-class for details.