WebSphere eXtreme Scale Programming Guide > Access data in WebSphere eXtreme Scale > EntityManager API introduction > Define an entity schema



emd.xsd file


Use the entity metadata XML schema definition to create a descriptor XML file and define an entity schema for WebSphere eXtreme Scale.

See the Entity metadata descriptor XML file for the descriptions of each element and attribute of the emd.xsd file.


emd.xsd file

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:emd="http://ibm.com/ws/projector/config/emd"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://ibm.com/ws/projector/config/emd"
    elementFormDefault="qualified" attributeFormDefault="unqualified"
    version="1.0">

   
<!-- **************************************************** -->
   
<xsd:element name="entity-mappings">
       
<xsd:complexType>
           
<xsd:sequence>
               
<xsd:element name="description" type="xsd:string" minOccurs="0" />
               
<xsd:element name="entity" type="emd:entity" minOccurs="1" maxOccurs="unbounded" />
           
</xsd:sequence>
       
</xsd:complexType>
       
<xsd:unique name="uniqueEntityClassName">
           
<xsd:selector xpath="emd:entity" />
           
<xsd:field xpath="@class-name" />
       
</xsd:unique>
   
</xsd:element>

   
<!-- **************************************************** -->
   
<xsd:complexType name="entity">
       
<xsd:sequence>
           
<xsd:element name="description" type="xsd:string" minOccurs="0" />
           
<xsd:element name="id-class" type="emd:id-class" minOccurs="0" />
           
<xsd:element name="attributes" type="emd:attributes" minOccurs="0" />
           
<xsd:element name="entity-listeners" type="emd:entity-listeners" minOccurs="0" />
           
<xsd:element name="pre-persist" type="emd:pre-persist" minOccurs="0" />
           
<xsd:element name="post-persist" type="emd:post-persist" minOccurs="0" />
           
<xsd:element name="pre-remove" type="emd:pre-remove" minOccurs="0" />
           
<xsd:element name="post-remove" type="emd:post-remove" minOccurs="0" />
           
<xsd:element name="pre-invalidate" type="emd:pre-invalidate" minOccurs="0" />
           
<xsd:element name="post-invalidate" type="emd:post-invalidate" minOccurs="0" />
           
<xsd:element name="pre-update" type="emd:pre-update" minOccurs="0" />
           
<xsd:element name="post-update" type="emd:post-update" minOccurs="0" />
           
<xsd:element name="post-load" type="emd:post-load" minOccurs="0" />
       
</xsd:sequence>
       
<xsd:attribute name="name" type="xsd:string" use="required" />
       
<xsd:attribute name="class-name" type="xsd:string" use="required" />
       
<xsd:attribute name="access" type="emd:access-type" />
       
<xsd:attribute name="schemaRoot" type="xsd:boolean" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="attributes">
       
<xsd:sequence>
           
<xsd:choice>
               
<xsd:element name="id" type="emd:id" minOccurs="0" maxOccurs="unbounded" />
           
</xsd:choice>
           
<xsd:element name="basic" type="emd:basic" minOccurs="0" maxOccurs="unbounded" />
           
<xsd:element name="version" type="emd:version" minOccurs="0" maxOccurs="unbounded"/>
           
<xsd:element name="many-to-one" type="emd:many-to-one" minOccurs="0" maxOccurs="unbounded" />
           
<xsd:element name="one-to-many" type="emd:one-to-many" minOccurs="0" maxOccurs="unbounded" />
           
<xsd:element name="one-to-one" type="emd:one-to-one" minOccurs="0" maxOccurs="unbounded" />
           
<xsd:element name="many-to-many" type="emd:many-to-many" minOccurs="0" maxOccurs="unbounded" />
           
<xsd:element name="transient" type="emd:transient" minOccurs="0" maxOccurs="unbounded" />
       
</xsd:sequence>
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:simpleType name="access-type">
       
<xsd:restriction base="xsd:token">
           
<xsd:enumeration value="PROPERTY" />
           
<xsd:enumeration value="FIELD" />
       
</xsd:restriction>
   
</xsd:simpleType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="id-class">
       
<xsd:attribute name="class-name" type="xsd:string" use="required" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="id">
       
<xsd:attribute name="name" type="xsd:string" use="required" />
       
<xsd:attribute name="type" type="xsd:string" />
       
<xsd:attribute name="alias" type="xsd:string" use="optional" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="transient">
       
<xsd:attribute name="name" type="xsd:string" use="required" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="basic">
       
<xsd:attribute name="name" type="xsd:string" use="required" />
       
<xsd:attribute name="alias" type="xsd:string" />
       
<xsd:attribute name="type" type="xsd:string" />
       
<xsd:attribute name="fetch" type="emd:fetch-type" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:simpleType name="fetch-type">
       
<xsd:restriction base="xsd:token">
           
<xsd:enumeration value="LAZY" />
           
<xsd:enumeration value="EAGER" />
       
</xsd:restriction>
   
</xsd:simpleType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="many-to-one">
       
<xsd:sequence>
           
<xsd:element name="cascade" type="emd:cascade-type" minOccurs="0" />
       
</xsd:sequence>
       
<xsd:attribute name="name" type="xsd:string" use="required" />
       
<xsd:attribute name="alias" type="xsd:string" />
       
<xsd:attribute name="target-entity" type="xsd:string" />
       
<xsd:attribute name="fetch" type="emd:fetch-type" />
       
<xsd:attribute name="id" type="xsd:boolean" />
   
</xsd:complexType>
   
<!-- **************************************************** -->
   
<xsd:complexType name="one-to-one">
       
<xsd:sequence>
           
<xsd:element name="cascade" type="emd:cascade-type" minOccurs="0" />
       
</xsd:sequence>
       
<xsd:attribute name="name" type="xsd:string" use="required" />
       
<xsd:attribute name="alias" type="xsd:string" />
       
<xsd:attribute name="target-entity" type="xsd:string" />
       
<xsd:attribute name="fetch" type="emd:fetch-type" />
       
<xsd:attribute name="mapped-by" type="xsd:string" />
       
<xsd:attribute name="id" type="xsd:boolean" />
   
</xsd:complexType>
   
<!-- **************************************************** -->
   
<xsd:complexType name="one-to-many">
       
<xsd:sequence>
           
<xsd:element name="order-by" type="emd:order-by" minOccurs="0" />
           
<xsd:element name="cascade" type="emd:cascade-type" minOccurs="0" />
       
</xsd:sequence>
       
<xsd:attribute name="name" type="xsd:string" use="required" />
       
<xsd:attribute name="alias" type="xsd:string" />
       
<xsd:attribute name="target-entity" type="xsd:string" />
       
<xsd:attribute name="fetch" type="emd:fetch-type" />
       
<xsd:attribute name="mapped-by" type="xsd:string" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="many-to-many">
       
<xsd:sequence>
           
<xsd:element name="order-by" type="emd:order-by" minOccurs="0" />
           
<xsd:element name="cascade" type="emd:cascade-type" minOccurs="0" />
       
</xsd:sequence>
       
<xsd:attribute name="name" type="xsd:string" use="required" />
       
<xsd:attribute name="alias" type="xsd:string" />
       
<xsd:attribute name="target-entity" type="xsd:string" />
       
<xsd:attribute name="fetch" type="emd:fetch-type" />
       
<xsd:attribute name="mapped-by" type="xsd:string" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:simpleType name="order-by">
       
<xsd:restriction base="xsd:string" />
   
</xsd:simpleType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="cascade-type">
       
<xsd:sequence>
           
<xsd:element name="cascade-all" type="emd:emptyType" minOccurs="0" />
           
<xsd:element name="cascade-persist" type="emd:emptyType" minOccurs="0" />
           
<xsd:element name="cascade-remove" type="emd:emptyType" minOccurs="0" />
           
<xsd:element name="cascade-invalidate" type="emd:emptyType" minOccurs="0" />
           
<xsd:element name="cascade-merge" type="emd:emptyType" minOccurs="0" />
           
<xsd:element name="cascade-refresh" type="emd:emptyType" minOccurs="0" />
       
</xsd:sequence>
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="emptyType" />

   
<!-- **************************************************** -->
   
<xsd:complexType name="version">
         
<xsd:attribute name="name" type="xsd:string" use="required"/>
         
<xsd:attribute name="alias" type="xsd:string" />
            
<xsd:attribute name="type" type="xsd:string" />
   
</xsd:complexType>

   
<!-- **************************************************** -->

   
<xsd:complexType name="entity-listeners">
       
<xsd:sequence>
           
<xsd:element name="entity-listener" type="emd:entity-listener" minOccurs="0" maxOccurs="unbounded" />
       
</xsd:sequence>
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="entity-listener">
       
<xsd:sequence>
           
<xsd:element name="pre-persist" type="emd:pre-persist" minOccurs="0" />
           
<xsd:element name="post-persist" type="emd:post-persist" minOccurs="0" />
           
<xsd:element name="pre-remove" type="emd:pre-remove" minOccurs="0" />
           
<xsd:element name="post-remove" type="emd:post-remove" minOccurs="0" />
           
<xsd:element name="pre-invalidate" type="emd:pre-invalidate" minOccurs="0" />
           
<xsd:element name="post-invalidate" type="emd:post-invalidate" minOccurs="0" />
           
<xsd:element name="pre-update" type="emd:pre-update" minOccurs="0" />
           
<xsd:element name="post-update" type="emd:post-update" minOccurs="0" />
           
<xsd:element name="post-load" type="emd:post-load" minOccurs="0" />
       
</xsd:sequence>
       
<xsd:attribute name="class-name" type="xsd:string" use="required" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="pre-persist">
       
<xsd:attribute name="method-name" type="xsd:string" use="required" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="post-persist">
       
<xsd:attribute name="method-name" type="xsd:string" use="required" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="pre-remove">
       
<xsd:attribute name="method-name" type="xsd:string" use="required" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="post-remove">
       
<xsd:attribute name="method-name" type="xsd:string" use="required" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="pre-invalidate">
       
<xsd:attribute name="method-name" type="xsd:string" use="required" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="post-invalidate">
       
<xsd:attribute name="method-name" type="xsd:string" use="required" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="pre-update">
       
<xsd:attribute name="method-name" type="xsd:string" use="required" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="post-update">
       
<xsd:attribute name="method-name" type="xsd:string" use="required" />
   
</xsd:complexType>

   
<!-- **************************************************** -->
   
<xsd:complexType name="post-load">
       
<xsd:attribute name="method-name" type="xsd:string" use="required" />
   
</xsd:complexType>

</xsd:schema>



Parent topic

Define an entity schema


+

Search Tips   |   Advanced Search