<?xml version='1.0' encoding='UTF-8' ?>

<!--
This is the XML DTD for the JAWS deployment descriptor.
  <!DOCTYPE jaws PUBLIC
      "-//JBoss//DTD JAWS 2.4//EN"
      "http://www.jboss.org/j2ee/dtd/jaws_2_4.dtd">
-->
<!-- The jaws element is always the root (document) node of the jaws.xml
 deployment descriptor or the standardjaws.xml defaults document. All elements
 are declared as optional - if not given in jaws.xml, defaults will be read 
 from standardjaws.xml -->
<!ELEMENT jaws (datasource? , type-mapping? , debug? , default-entity? , enterprise-beans? , type-mappings?)>

<!-- the datasource element is used to indicate to JAWS which datasource
 should be used for persistence of the CMP entities in this ejb-jar. It 
 should be the datasource named as it appears in jboss' global naming 
 context. The default is java:/DefaultDS 
 
 Beans are also allowed to specify datasources at bean level and will override this datasource if specified.

Used in: jaws, entity
 -->
<!ELEMENT datasource (#PCDATA)>

<!-- the type-mapping element is used to indicate to JAWS which set of mappings
 from java types to jdbc and SQL types to be used for CMP beans in this jar.
 type-mappings are defined withing the type-mappings element with a type-mapping
 element that carries a separate meaning: This DTD wil not parse! -->
<!ELEMENT type-mapping (#PCDATA)>

<!ELEMENT debug (#PCDATA)>

<!ELEMENT default-entity (create-table , remove-table , tuned-updates , read-only , pk-constraint? , select-for-update? , time-out)>

<!ELEMENT create-table (#PCDATA)>

<!ELEMENT remove-table (#PCDATA)>

<!ELEMENT tuned-updates (#PCDATA)>

<!ELEMENT read-only (#PCDATA)>

<!ELEMENT pk-constraint (#PCDATA)>

<!ELEMENT select-for-update (#PCDATA)>

<!ELEMENT time-out (#PCDATA)>

<!-- the enterpris-beans tag contains overridden attribute mappings for any
 CMP bean in this ejb-jar that requires non-default column mapping behavior -->
<!ELEMENT enterprise-beans (entity*)>

<!-- the entity element defines a non-default column mapping for a CMP entity
 bean in this ejb-jar. This includes query specifications for any finders that
 either do not correspond to a single cmp-field or that require a specific 
 ordering. it must contain an ejb-name element, can contain 0 or more cmp-field
 elements and my contain 0 or more finder elements. 
 Other options include:
 read-ahead: When a finder is called, load all data for all entities.
 read-only: Do not persist any changes to the bean's state.
 table-name: Name of the corresponding table.
 tuned-updates: emit 'update' SQL statements that update only changed fields.
 create-table: On deploy, create the table if it doesn't exist.
 remove-table: On undeploy, drop the table from the database (with _all_ _data_!!! 
 select-for-update: On loading the bean, use the 'select ... for update' syntax,
      locking the row.
 pk-constraint: If create-table is on, create it with a primary key.
 time-out: For read-only only, re-load entity after time-out
-->
<!ELEMENT entity (ejb-name , datasource? , cmp-field* , finder* , read-ahead? , read-only? , table-name? , tuned-updates? , create-table? , remove-table? , select-for-update? , time-out? , pk-constraint?)>

<!-- ejb-name within an entity element must contain the ejb-name as specified
 in ejb-jar.xml. -->
<!ELEMENT ejb-name (#PCDATA)>

<!ELEMENT cmp-field (field-name , column-name , (jdbc-type , sql-type)?)>

<!ELEMENT field-name (#PCDATA)>

<!ELEMENT column-name (#PCDATA)>

<!-- the finder element overrides JAWS default behavior for a finder, or
 specifies JAWS behavior for finders requiring multi-column where clauses or
 a specific ordering. it must contain name and query elements and my contain
 1 order element.
 After JBoss version 2.3, it may contain a read-ahead element indicating whether
 or not all data for the entities selected should be loaded immediatly. Note 
 that JAWS/JBoss cannot guarentee serializable transactions with the read-ahead 
 option!-->
<!ELEMENT finder (name , query , order? , read-ahead?)>

<!-- the name within a finder element must contain the name of the finder 
 method from the bean's home interface -->
<!ELEMENT name (#PCDATA)>

<!-- the query element must contain the where clause that will select the 
 proper rows to be returned by the finder. If this query begins with an
 inner join clause, it may specify multiple tables. -->
<!ELEMENT query (#PCDATA)>

<!-- the order element should contain a SQL order by clause (without the 
 initial 'order by' verb!) that should be used to order the results of the 
 query for the finder -->
<!ELEMENT order (#PCDATA)>

<!ELEMENT read-ahead (#PCDATA)>

<!ELEMENT table-name (#PCDATA)>

<!ELEMENT type-mappings (type-mapping-definition*)>

<!ELEMENT type-mapping-definition (name , mapping*)>

<!ELEMENT mapping (java-type , jdbc-type , sql-type)>

<!ELEMENT java-type (#PCDATA)>

<!ELEMENT jdbc-type (#PCDATA)>

<!ELEMENT sql-type (#PCDATA)>

