Administration guide > Configure the deployment environment > Configuring entities


Entity metadata descriptor XML file

The entity metadata descriptor file XML file is used to define an entity schema for WebSphere eXtreme Scale. Define all of the entity metadata in the XML file, or define the entity metadata as annotations on the entity Java class file. The primary use is for entities that cannot use Java annotations.

Use XML configuration to create entity metadata that is based on the XML file. When used in conjunction with annotation, some of the attributes that are defined in the XML configuration override the corresponding annotations. If you can override an element, the override is explicitly in the following sections.

See emd.xsd file for an example of the entity metadata descriptor XML file.


id element

The id element implies that the attribute is a key. At a minimum, at least one id element must be specified. You can specify multiple id keys for use as a compound key.


Attributes

name Name of the attribute. The attribute must exist in the Java file.
alias Element alias. The alias value is overridden if used in conjunction with an annotated entity.


basic element

The basic element implies that the attribute is a primitive type or wrappers to primitive types:

It is not necessary to specify any attribute as basic. The basic element attributes are automatically configured using reflection.


Attributes

name Name of the attribute in the class.
alias Element alias. The alias value is overridden if used in conjunction with an annotated entity.
fetch Fetch type. Valid values include: LAZY or EAGER.


id-class element

The id_class element specifies a compound key class, which helps to find entities with compound keys.


Attributes

class-name

Class name, which is an id-class, to use with the id-class element.


transient element

The transient element implies that it is ignored and not processed. It also can be overridden if used in conjunction with annotated entities.


Attributes

name

Name of the attribute, which is ignored.


version element


Attributes

name

Name of the attribute, which is ignored.


cascade-type element


Child elements


one-to-one element


Attributes

name

Name of the class, which has a one-to-one relationship.

alias

Specifies a name alias.

target-entity

Association class. This value is a fully-qualified class name.

fetch

Fetch type. Valid values include: LAZY or EAGER.

mapped-by

Field that owns the relationship. The mapped-by element is only specified on the inverse (non-owning) side of the association.

id

Identifies the association as key.


Child elements


one-to-many element


Attributes

name

Name of the attribute in the class.

alias

Specifies a name alias.

target-entity

Association class. This value is a fully-qualified class name.

fetch

Fetch type. Valid values include: LAZY or EAGER.

mapped-by

Field that owns the relationship. The mapped-by element is only specified on the inverse (non-owning) side of the association.


Child elements


many-to-one element


Attributes

name

Name of the attribute in the class.

alias

Specifies a name alias.

target-entity

Class to which this attribute refers. This value is a fully-qualified class name.

fetch

Fetch type. Valid values include: LAZY or EAGER.

id

Identifies the association as a key.


Child elements


many-to-many element


Attributes

name

Name of the attribute in the class.

alias

Specifies a name alias.

target-entity

Class to which this attribute refers. This value is a fully-qualified class name.

fetch

Fetch type. Valid values include: LAZY or EAGER.

mapped-by

Filed that owns the relationship. The mapped-by element is only specified on the inverse (non-owning) side of the association.


Child elements


attributes element


Child elements


Entity element


Attributes

name(required)

Name of the attribute in the class.

class-name

Fully-qualified class name.

access

Access type. The valid values are PROPERTY or FIELD.

schemaRoot

Specifies that this entity is the schema root and is used as a parent class for partitioned data.


Child elements


entity-mappings element


Child elements


entity-listener element


Attributes

class-name (required)

Name of the listener class.


Child elements


PrePersist element


Attributes

method-name (required)

Lifecycle callback method for the PrePersist event.


PostPersist element


Attributes

method-name (required)

Lifecycle callback method for the PostPersist event.


PreRemove element


Attributes

method-name (required)

Lifecycle callback method for the PreRemove event.


PreUpdate element


Attributes

method-name (required)

Lifecycle callback method for the PreUpdate event.


PostUpdate element


Attributes

method-name (required)

Lifecycle callback method for the PostUpdate event.


PostLoad element


Attributes

method-name (required)

Lifecycle callback method for the PostLoad event.


Parent topic:

Configure entities


Related concepts

Relationship management
EntityManager API


Related tasks

Entity manager tutorial

Related reference

emd.xsd file