##### Search XDoclet

## @kodo Tag Reference

JDO tags specific for Solarmetric's Kodo.

Applies to: classes to be persistence-capable on class and field level

### @kodo Class Level Tags

@kodo.table

### @kodo Method Level Tags

### @kodo Field Level Tags

@kodo.field

## @kodo Class Level Tag Usage

### @kodo.table (0..1)

The kodo.table tag gives access to the Kodo extensions at the class level to be included in the generated jdo metadata.

Applies to: The jdo.persistence-capable tag must be present

Parameter | Type | Applicability | Description | Mandatory
--- | --- | --- | --- | ---
pk-column | text |  | This 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, Kodo will add its own primary key column, usually named JDOIDX. | false

lock-column

text

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.
Default value(s):
JDOLOCKX

false

class-column

text

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.
Default value(s):
JDOCLASSX

false

## @kodo Method Level Tag Usage

## @kodo Field Level Tag Usage

### @kodo.field (0..*)

The kodo.field tag gives access to the Kodo extensions at the field level to be included in the generated jdo metadata.

Applies to: The jdo.field tag must be present

Parameter | Type | Applicability | Description | Mandatory
--- | --- | --- | --- | ---

blob

bool

This extension can be used to explicitly mark fields that should be stored as serialized BLOB values. For example, Kodo JDO would normally store a field of type byte[] using a secondary table with a row for each byte value in the array; this type of storage allows for queries on the array. If the byte[] is large or contains information that should not be query-able, it may be more efficient to store it as a BLOB column of the main table. Fields that Kodo JDO cannot normally persist, such as user-defined interface fields or fields of type java.lang.Object are defaulted to use BLOB mappings. In these cases this extension is not necessary, though it is still allowed.

false

column-length

int

String fields can specify the maximum length of the String that will be stored in the database column. The default maximum is 255 characters. Use a value of -1 to indicate that there should be no length limit on the String. In this case, the column will be created as a CLOB, or the correct database equivalent. Currently, this extension is used only when creating a schema using the schematool. In the future, this extension may be also used for performing runtime data validations.

false

column-index | bool |  | Specifies whether the column holding the data for the field should be indexed. | false

ordered

bool

By default, databases do not guarantee the order in which results are read. Thus, collection and array field elements may be retrieved from the database in a different order from the one in which they were stored. A value of true for this key, however, will ensure that the order of the elements in this field is retained during database reads. This flag is useful only for collection and array fields that represent a one-sided relationship, such as a collection of simple values or a 1-sided many-to-many relation. It cannot be used for one-to-many relations or shared many-to-many relations. See the order-column extension for more information.

false

embedded

bool

Specifies whether the field should be stored if possible as part of the instance instead of as its own instance in the datastore. It defaults to "true" for fields of primitive types, java.util.Date, and fields of java.lang, java.math, and array types specified above. This attribute is only a hint to the implementation. A compliant implementation is permitted to support these types as first class instances in the datastore. A portable application should not depend on the embedded treatment of persistent fields.

false

order-column

text

This extension is applicable only to collection fields that also have the ordered extension.

Specifies the column of the secondary table used to hold ordering information. This column must be of a numeric type. If the ordered extension is given but this extension is omitted, Kodo JDO will create its own order column, usually named JDOORDERX.
Default value(s):
JDOORDERX

false

read-only

text

Must be used with collection or array valued persistent field

This extension is used for collection fields that represent a shared many-to-many mapping. In such mappings, one class can declare its field to be read-only in order to avoid duplicate inserts into the shared table. The value of this extension should be either true or false. Note that Kodo JDO typically makes one side of the relation read-only automatically; this extension is never strictly needed.

false