The entity metadata descriptor
file is an XML file that
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
- Specifies the name of the attribute. The attribute must exist
in the Java file.
- alias
- Specifies the 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:
- java.lang.String
- java.math.BigInteger
- java.math.BigDecimal
- java.util.Date
- java.util.Calendar
- java.sql.Date
- java.sql.Time
- java.sql.Timestamp
- byte[]
- Byte[]
- char[]
- Character[]
- Java Platform, Standard Edition Version 5
enum
It is not necessary to specify any attribute as basic.
The basic
element attributes are automatically configured using reflection.
Attributes- name
- Specifies the name
of the attribute in the class.
- alias
- Specifies the element alias. The alias value is overridden if
used in conjunction with an annotated entity.
- fetch
- Specifies the 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
- Specifies the 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
- Specifies the name
of the attribute, which is ignored.
version element
Attributes- name
- Specifies the name of the attribute, which is ignored.
cascade-type
element
Child elements- cascade-all:
Cascades the all operation to associations.
- cascade-persist:
Cascades the persist operation to associations.
- cascade-remove:
Cascades the remove operation to associations.
- cascade-merge:
Currently not used.
- cascade-refresh: Currently not
used.
one-to-one
element
Attributes
- name
- Specifies the name of the class, which has a one-to-one relationship.
- alias
- Specifies
a name alias.
- target-entity
- Specifies the association class. This value is a fully-qualified
class name.
- fetch
- Specifies the fetch type. Valid values include: LAZY or EAGER.
- mapped-by
- Specifies
the 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.
one-to-many element
Attributes
- name
- Specifies the name
of the attribute in the class.
- alias
- Specifies a name alias.
- target-entity
- Specifies the association class. This value is a fully-qualified
class name.
- fetch
- Specifies the fetch type. Valid values include: LAZY or EAGER.
- mapped-by
- Specifies
the field that owns the relationship. The mapped-by
element is only specified on the inverse (non-owning) side of the
association.
many-to-one element
Attributes
- name
- Specifies the name
of the attribute in the class.
- alias
- Specifies a name alias.
- target-entity
- Specifies the class to which this attribute refers. This value
is a fully-qualified class name.
- fetch
- Specifies the fetch type. Valid values include: LAZY or EAGER.
- id
- Identifies
the association as a key.
many-to-many
element
Attributes
- name
- Specifies the name of the attribute in the class.
- alias
- Specifies a name alias.
- target-entity
- Specifies
the class to which this attribute refers. This value
is a fully-qualified class name.
- fetch
- Specifies the fetch type. Valid values include: LAZY or EAGER.
- mapped-by
- Specifies
the field that owns the relationship. The mapped-by
element is only specified on the inverse (non-owning) side of the
association.
Entity element
Attributes- name(required)
- Specifies
the name of the attribute in the class.
- class-name
- Specifies the fully-qualified class name.
- access
- Specifies the 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.
entity-listener element
Attributes- class-name (required)
- Specifies
the name of the listener class.
PrePersist element
Attributes- method-name (required)
- Specifies
the lifecycle callback method for the PrePersist event.
PostPersist
element
Attributes- method-name (required)
- Specifies the lifecycle callback method for the PostPersist event.
PreRemove
element
Attributes- method-name (required)
- Specifies the lifecycle callback method for the PreRemove event.
PreUpdate
element
Attributes- method-name (required)
- Specifies the lifecycle callback method for the PreUpdate event.
PostUpdate
element
Attributes- method-name (required)
- Specifies the lifecycle callback method for the PostUpdate event.
PostLoad
element
Attributes- method-name (required)
- Specifies the lifecycle callback method for the PostLoad event.