database.dtd: Elements - Entities - Source | Intro - Index
FRAMES / NO FRAMES

Torque/DdlUtils XML database schema DTD

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.



<database> Root element

This defines the schema for a database. More precisely, it contains a number of DML elements that define the schema, such as tables, foreign key relationships, indexes and so forth.
Note: DdlUtils only uses the name attribute. All other attributes are Torque-specific.

<database>'s children
NameCardinality
external-schemaAny number
tableAt least one
<database>'s attributes
NameValuesDefault
baseClass
basePeer
defaultIdMethodidbroker, native, autoincrement, sequence, nonenone
defaultJavaNamingMethodnochange, underscore, javanameunderscore
defaultJavaTypeobject, primitiveprimitive
heavyIndexingtrue, falsefalse
name
package
Element's model:

(external-schema*, table+)


@name Attribute of database

The name of the database.


@defaultIdMethod Attribute of database

Defines how values for identity columns are generated. Do not use autoincrement or sequence. They are deprecated in favor of using native which will use the Turbine Connection pool to determine which database it is talking to (yes, it knows that) and then use whatever native database methodology for insert increments that it can. Otherwise, you should use idbroker or none. none is good if you have a table that is just a join table. idbroker is good if you want a centralized repository for brokering out clumps of id's in a database agnostic way.
Note: This attribute is ignored by DdlUtils.

Possible values: idbroker, native, autoincrement, sequence, none - Default value: none


@defaultJavaType Attribute of database

Whether jdbc types are mapped to primitive types such as int (if possible) by default, or to reference types such as java.lang.Integer.
Note: This attribute is ignored by DdlUtils.

Possible values: object, primitive - Default value: primitive


@package Attribute of database

The package of the Java classes generated from this schema.
Note: This attribute is ignored by DdlUtils.


@baseClass Attribute of database

The base class for the Java classes generated from this schema.
Note: This attribute is ignored by DdlUtils.


@basePeer Attribute of database

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.


@defaultJavaNamingMethod Attribute of database

Determines how a table or column name is converted from the name attribute in the xml database file to a Java class or method name:

nochange
Indicates not change is performed.
underscore
Underscores are removed, First letter is capitalized, first letter after an underscore is capitalized, the rest of the letters are converted to lowercase.
javaname
Same as underscore, but no letters are converted to lowercase.

Note: This attribute is ignored by DdlUtils.

Possible values: nochange, underscore, javaname - Default value: underscore


@heavyIndexing Attribute of database

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.

Possible values: true, false - Default value: false


<external-schema/> Child of database

Sorry, no documentation available
Note: DdlUtils currently ignores this element.

<external-schema>'s attributes
NameValuesDefault
filename

This element is always empty.


@filename Attribute of external-schema

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.

Required


<table> Child of database

Defines a table in the database schema.

<table>'s children
NameCardinality
columnAt least one
foreign-keyAny number
id-method-parameterAny number
indexAny number
uniqueAny number
<table>'s attributes
NameValuesDefault
abstracttrue, falsefalse
alias
baseClass
basePeer
description
heavyIndexingtrue, false
idMethodidbroker, native, autoincrement, sequence, none, nullnull
interface
javaName
javaNamingMethodnochange, underscore, javaname
name
skipSqltrue, falsefalse
Element's model:

(column+, (foreign-key | index | unique | id-method-parameter)*)


@name Attribute of table

The name of this table.

Required


@javaName Attribute of table

The name of the Java class generated from this table.
Note: This attribute is ignored by DdlUtils.


@idMethod Attribute of table

Defines how values for identity columns are generated. See database.defaultIdMethod for more info.
Note: This attribute is ignored by DdlUtils.

Possible values: idbroker, native, autoincrement, sequence, none, null - Default value: null


@skipSql Attribute of table

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.

Possible values: true, false - Default value: false


@abstract Attribute of table

Whether the class generated from this table is abstract.
Note: This attribute is ignored by DdlUtils.

Possible values: true, false - Default value: false


@baseClass Attribute of table

Base class for the java class generated from this table.
Note: This attribute is ignored by DdlUtils.


@basePeer Attribute of table

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.


@alias Attribute of table

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.


@interface Attribute of table

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.


@javaNamingMethod Attribute of table

How the name of the corresponding java class is generated. See database.defaultJavaNamingMethod for more info. Use nochange if the default naming method shall be used.
Note: This attribute is ignored by DdlUtils.

Possible values: nochange, underscore, javaname


@heavyIndexing Attribute of table

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.

Possible values: true, false


@description Attribute of table

Description of the table.


<id-method-parameter/> Child of table

Sorry, no documentation available
Note: DdlUtils currently ignores this element.

<id-method-parameter>'s attributes
NameValuesDefault
namedefault
value

This element is always empty.


@name Attribute of id-method-parameter

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.

Default value: default


@value Attribute of id-method-parameter

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.

Required


<column> Child of table

Defines a column in a table.

<column>'s children
NameCardinality
inheritanceAny number
<column>'s attributes
NameValuesDefault
autoIncrementtrue, falsefalse
default
description
inheritancesingle, falsefalse
inputValidator
javaName
javaNamingMethodnochange, underscore, javaname
javaTypeobject, primitive
name
primaryKeytrue, falsefalse
requiredtrue, falsefalse
size
typeBIT, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, REAL, NUMERIC, DECIMAL, CHAR, VARCHAR, LONGVARCHAR, DATE, TIME, TIMESTAMP, BINARY, VARBINARY, LONGVARBINARY, NULL, OTHER, JAVA_OBJECT, DISTINCT, STRUCT, ARRAY, BLOB, CLOB, REF, BOOLEANINT, BOOLEANCHAR, DOUBLEVARCHAR
Element's model:

(inheritance*)


@name Attribute of column

The name of this column.

Required


@javaName Attribute of column

The name of the Java field generated from this column.
Note: This attribute is ignored by DdlUtils.


@primaryKey Attribute of column

Whether this is a primary key column.

Possible values: true, false - Default value: false


@required Attribute of column

Whether this is a required column, i.e. a column that is not allowed to contain NULL values. Note that primary key columns are not automatically required.

Possible values: true, false - Default value: false


@type Attribute of column

The JDBC type of the column. This will be automatically translated to a type native to the database.

Possible values: BIT, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, REAL, NUMERIC, DECIMAL, CHAR, VARCHAR, LONGVARCHAR, DATE, TIME, TIMESTAMP, BINARY, VARBINARY, LONGVARBINARY, NULL, OTHER, JAVA_OBJECT, DISTINCT, STRUCT, ARRAY, BLOB, CLOB, REF, BOOLEANINT, BOOLEANCHAR, DOUBLE - Default value: VARCHAR


@javaType Attribute of column

Whether the jdbc type is mapped to a primitive type such as int (if possible), or to a reference type such as java.lang.Integer.
Note: This attribute is ignored by DdlUtils.

Possible values: object, primitive


@size Attribute of column

The JDBC size specification of the column. This is type specific. For types that have a length (such as VARCHAR), specify a single number specifying this length. For types that have precision and scale (such as NUMERIC), specify a pair of values "precision,scale".


@default Attribute of column

The default value of the column if any. Do not specify this attribute unless the column shall have a default value as an empty attribute value will be passed as an empty string (not NULL) to the database. This value is passed as is to the database, though you don't need to quote it for e.g. string values.


@autoIncrement Attribute of column

Whether this column is an identity column, i.e. it's value is automatically defined by the database.

Possible values: true, false - Default value: false


@inheritance Attribute of column

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.

Possible values: single, false - Default value: false


@inputValidator Attribute of column

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.


@javaNamingMethod Attribute of column

How the name of the corresponding java field is generated. See database.defaultJavaNamingMethod for more info. Use nochange if the default naming method shall be used.
Note: This attribute is ignored by DdlUtils.

Possible values: nochange, underscore, javaname


@description Attribute of column

Description of the column.


<inheritance/> Child of column

Sorry, no documentation available
Note: DdlUtils currently ignores this element.

<inheritance>'s attributes
NameValuesDefault
class
extends
key

This element is always empty.


@key Attribute of inheritance

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.

Required


@class Attribute of inheritance

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.

Required


@extends Attribute of inheritance

Sorry, no documentation available.
Note: This attribute is ignored by DdlUtils.


<foreign-key> Child of table

Defines a foreign key relation from the table this element is defined in, to another table.

<foreign-key>'s children
NameCardinality
referenceAt least one
<foreign-key>'s attributes
NameValuesDefault
foreignTable
name
onDeletecascade, setnull, restrict, nonenone
onUpdatecascade, setnull, restrict, nonenone
Element's model:

(reference+)


@foreignTable Attribute of foreign-key

The name of the foreign table

Required


@name Attribute of foreign-key

The name of this foreign key. Even though you can leave it empty, we suggest that you always supply a meaningful name for foreign keys.


@onUpdate Attribute of foreign-key

Specifies the action to perform when the value in the referenced column in the foreign table is changed:

cascade
Change the value of the local column accordingly.
setnull
Set the local column to NULL which effectively removes this specific foreign key relationship.
restrict
Different databases may interpret this value differently, but usually it is synonymous with none.
none
The value of the local column remains unchanged.

Note: This attribute is currently ignored by DdlUtils.

Possible values: cascade, setnull, restrict, none - Default value: none


@onDelete Attribute of foreign-key

Specifies the action to perform when the referenced row in the foreign table is deleted:

cascade
Delete the local row.
setnull
Set the local column to NULL which effectively removes this specific foreign key relationship.
restrict
Different databases may interpret this value differently, but usually it is synonymous with none.
none
The value of the local column remains unchanged.

Note: This attribute is currently ignored by DdlUtils.

Possible values: cascade, setnull, restrict, none - Default value: none


<reference/> Child of foreign-key

A foreign key is specified by one or more references which put a column in the current table and a column in the foreign table into relation.

<reference>'s attributes
NameValuesDefault
foreign
local

This element is always empty.


@local Attribute of reference

The name of the column in the current table

Required


@foreign Attribute of reference

The name of the column in the foreign table

Required


<index> Child of table

Defines a non-unique index for the current table.

<index>'s children
NameCardinality
index-columnAt least one
<index>'s attributes
NameValuesDefault
name
Element's model:

(index-column+)


@name Attribute of index

The name of this index. Even though you can leave it empty, we suggest that you always supply a meaningful name for foreign keys.


<index-column/> Child of index

An index is defined for one or more columns of a table, which are specified by this element.

<index-column>'s attributes
NameValuesDefault
name
size

This element is always empty.


@name Attribute of index-column

The name of the column in the current table.

Required


@size Attribute of index-column

The size of the column within the index.
Note: This attribute is currently ignored by DdlUtils.


<unique> Child of table

Defines an unique index for the current table.

<unique>'s children
NameCardinality
unique-columnAt least one
<unique>'s attributes
NameValuesDefault
name
Element's model:

(unique-column+)


@name Attribute of unique

The name of this index. Even though you can leave it empty, we suggest that you always supply a meaningful name for foreign keys.


<unique-column/> Child of unique

An unique index is defined for one or more columns of a table, which are specified by this element.

<unique-column>'s attributes
NameValuesDefault
name

This element is always empty.


@name Attribute of unique-column

The name of the column in the current table.

Required