@jdo Tag Reference

JDO tags used to generate jdo xml metadata. The tag names are identical to the element names in jdo.dtd.

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

@jdo Class Level Tag Usage

@jdo.persistence-capable (0..1)

The jdo.persistence-capable tag provides information about the JDO persistent bean. Its presence determines if your class will be included in the generated jdo metadata.

Applies to: The presence of the jdo.persistence-capable tag determines if a class will be included in the generated jdo metadata and thus if it will be enhanced to PersistenceCapable

Parameter Type Applicability Description Mandatory
identity-type text Specifies whether objects are uniquely identified by a jdo-implementation provided abstract identifier (datastore identity), accessible fields in the object (application identity), or not at all (nondurable identity).
Valid options are:

application

datastore

nondurable

Default value(s):

datastore
true
objectid-class text The fully-qualified class name for the application identity object id. Use only with application identity. false
requires-extent bool Specifies whether the jdo implementation must provide an extent for this class.

Default value(s):

true
false
persistence-capable-superclass text Fully-qualified class name of the PersistenceCapable super class, if any. false

@sql.table (0..1)

Defines the mapping to a relational database. To use if the JDO bean is to be persisted on a relational database.

Applies to: Applicable to the whole class.

Parameter Type Applicability Description Mandatory
table-name text Name of the table to map to. false

@jdo Field Level Tag Usage

@jdo.field (0..1)

Defines a JDO persistent field. The jdo.field tag can be used on any persistent field or to specify non-default properties. Many jdo implementation require explicit listing of collection-valued fields.

Applies to: The jdo.field tag can be used on any persistent field or to specify non-default properties. Many jdo implementation require explicit listing of collection-valued fields.

Parameter Type Applicability Description Mandatory
persistence-modifier text Specifies if the field is persistent, transactional or none of these.
Valid options are:

persistent

transactional

none

Default value(s):

persistent
false
primary-key bool Specifies whether or not this field is part of the primary key for application identity.

Default value(s):

false
false
null-value text Specifies the treatment (exception, default, or none) of null values for persistent fields during storage in the data store.
Valid options are:

exception

default

none

Default value(s):

none
false
default-fetch-group bool Specifies whether this field is managed as a group with other fields. It defaults to "true" for non-key fields of primitive types, java.util.Date, and fields of java.lang, java.math types specified above. 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
collection-type text The collection-type property specifies the type (collection, map, or array) of a collection valued field and provides details about the elements and their storage.
Valid options are:

collection

map

array
false
element-type text Must be used with collection or array valued persistent field The element-type property specifies the fully qualified java class name of the element of a collection or array-valued persistent field. false
embedded-element bool Must be used only with a collection or array valued persistent field. The embedded-element property specifies whether the elements of a collection or array-valued persistent field should be stored embedded or as first class objects.

Default value(s):

true
false
key-type text Must be used only with a map valued persistent field. The key-type property specifies the fully qualified java class name of the keys of map-valued persistent field. false
embedded-key bool Must be used only with a map valued persistent field. The embedded-key property specifies whether the keys of a map-valued persistent field should be stored embedded or as first class objects.

Default value(s):

true
false
value-type text Must be used only with a map valued persistent field. The value-type property specifies the fully qualified java class name of the values of map-valued persistent field. false
embedded-value bool Must be used only with a map valued persistent field. The embedded-value property specifies whether the values of a map-valued persistent field should be stored embedded or as first class objects.

Default value(s):

true
false

@sql.field (0..*)

Defines the mapping of a field to a relational database. To use if the JDO bean is to be persisted on a relational database. Usually only one @jdo.mapping tag is required for a basic persistent field, except for fields that link to a persistence-capable class, where there are as many @jdo.mapping tags as there are foreign keys to this class, and for fields that represent a 1:n relationship where no @jdo.mapping tag is required, and finally for fields that represent a n:m relationship where there are as many @jdo.mapping tags as there are foreign keys from the relation table to the table for this class.

Applies to: Applicable to a persistent field (basic field or object relationship)

Parameter Type Applicability Description Mandatory
table-name text The field must be in a sub-class mapped partially onto another table. (Experimental) For basic fields part of an inheritance mapping onto multiple tables, the name of the table that the field is mapped to. false
column-name text Applicable only on a persistent field Name of the column to map the field to. For fields representing a n:m relationship, name of one of the foreign key column in the relation table pointing to the table for this class. true
related-field text The field must be a collection representing a n:m relationship Name of the field in this class matching the foreign key in the relation table. false

@sql.relation (0..1)

Further defines the mapping of a field of type Collection.

Applies to: Applicable to a persistent field of type Collection

Parameter Type Applicability Description Mandatory
style text Applicable only on a persistent field of type Collection The style of the mapping between this class and the objects contained in the collection. For 1:n relationships, the style is 'foreign-key'. For n:m relationships, the style is 'relation-table'
Valid options are:

foreign-key

relation-table
true
table-name text Applicable only on a persistent field of type Collection used in a n:m relationship Name of the relation table when style is 'relation-table' false
related-field text Applicable only on a persistent field of type Collection Name of the field in the class contained in the collection refering to this class. For a 1:n relationship, this is a field of the same type as this class, for a n:m relationship, it is a field of type Collection containing elements of the same type as this class. false