Torque Schema ReferenceTorque スキーマリファレンスThe Torque Database Schema Reference attempts to explain what the different elements and attributes are when defining your own database schema. In addition I will attempt to explain what attributes mean what in the different databases currently supported. このTorqueデータベーススキーマリファレンスは、 データベーススキーマを定義する際の様々な要素や属性について、 詳細に説明することを試みます。 さらに、様々なデータベースでの現在の属性のサポートについても説明します。 Elements and their attributes要素と属性Some of the following examples are taken from the project-schema.xml document in the src/conf/torque/schema. 以下の例のうちのいくつかは src/conf/torque/schema の中の project-schema.xmlドキュメントから取得できます。 Element: database要素: databaseThe database element and its relevant attributes. これはdatabase要素と関連する属性です。
<database
name="MY_DATABASE"
defaultIdMethod="idBroker"
package="com.myapp.om"
baseClass="com.myapp.om.BaseClass"
basePeer="com.myapp.om.BasePeer">
<table name="SIMPLE">
<!-- table info goes here -->
</table>
</database>
The database element has 8 attributes associated with it, they are: database要素は8つの属性を持ちます。それらは:
The database element can contain the following elements: database 要素は以下の要素を内包できます:
Attribute: defaultIdMethod属性: defaultIdMethodBy defining this attribute at the database level it applies the defaultIdMethod to those tables which do not have an idMethod attribute defined. The attribute defaultIdMethod has 5 possible values, they are: database要素にこの属性を定義することにより、 idMethod属性を定義していないテーブルにdefaultIdMethodを適用します。 属性defaultIdMethodは5つの有効な値を持っています。 それらは:
Attribute: defaultJavaNamingMethod属性: defaultJavaNamingMethodThis attribute determines how table or column names, from the name attribute of the table or column element, are converted to a Java class or method name respectively when creating the OM Java objects. defaultJavaNamingMethod can contain 3 different values: この属性は、OM Javaオブジェクトを作成するときに、 テーブル名または列名(table要素またはcolumn要素のname属性)を、 Javaクラス名またはメソッド名にどのようにそれぞれ変換するかを決定します。 defaultJavaNamingMethodは3つの異なる値を含むことができます:
Attribute: package属性: packageThe base package in which this database will generate the Object Models associated with it. This overrides the targetPackage property in the Torque build.properties file. データベースがオブジェクトモデルを生成したときのベースパッケージとなります。 これは、Torqueのbuild.propertiesファイル中のtargetPackageプロパティをオーバライドします。 Attribute: baseClass属性: baseClassThe base class to use when generating the Object Model. This class does not have to extend org.apache.turbine.om.BaseObject. オブジェクトモデルを生成する際に使用するベースクラスです。 このクラスはorg.apache.turbine.om.BaseObjectを継承する必要はありません。 Attribute: basePeer属性: basePeerThe base peer to use when generating the Object Model Peers. Unlike baseClass, basePeer should extend BasePeer at some point in the chain, i.e it needs to be the superclass. オブジェクトモデルのPeerを生成する際に使用されます。 baseClassと異なり、basePeerは継承階層のいずれかでBasePeerを継承するべきです。言い換えれば、スーパークラスであることが必要です。 Element: table要素: tableThe table element and its relevant attributes これはtable要素と関連する属性です。
<table
name="MY_TABLE"
javaName="table"
idMethod="idbroker"
skipSql="false"
baseClass="com.myapp.om.table.BaseClass"
basePeer="com.myapp.om.table.BasePeer"
javaNamingMethod="underscore"
description="Table for Torque tests">
<!-- column information here -->
</table>
The table element has 13 attributes associated with it, they are: table要素は13の属性を持ちます。それらは:
The table element can contain the following elements: table要素は以下の要素を内包できます:
Attribute: javaName属性: javaNameThis is the Java class name to use when generating the Table or column. If this is missing the Java name is generated in the following manner: これはテーブルまたはカラムを生成する場合に使用するJavaクラス名です。 これが見当たらない場合、Java名は次の方法で生成されます: Underscores are removed, first letter and first letter after each underscore is uppercased, all other letters are lowercased. So YOUR_TABLE_NAME would become YourTableName. アンダースコアは削除され、一番最初の一文字、 および各アンダーラインの後の一文字は大文字となります。 他のすべての文字は小文字となります。 したがって、YOUR_TABLE_NAMEはYourTableNameになります。 Element: column要素: columnThe column element and its relevant attributes これはcolumn要素と関連する属性です。
<column
name="MY_COLUMN"
javaName="Column"
primaryKey="true"
required="true"
size="4"
type="VARCHAR"
javaNamingMethod="underscore">
<!-- inheritance info if necessary -->
</column>
The column element has 13 attributes associated with it, they are: column要素は13の属性を持ちます。それらは:
The column element can contain the following elements: column要素は以下の要素を内包できます:
Element: inheritance要素: inheritanceThe inheritance element and its relevant attributes これはinheritance要素と関連する属性です。
<inheritance key="key"
class="classname"
extends="mybase"/>
The inheritance element has 3 attributes associated with it, they are: inheritance要素は3つの属性を持ちます。それらは:
The inheritance element can not contain other elements. inheritance要素は他の要素を含むことはできません。 Element: foreign-key要素: foreign-keyThe foreign-key element and its relevant attributes これはforein-key要素と関連する属性です。
<foreign-key foreignTable="MY_TABLE"
name="MY_TABLE_FK"
onUpdate="none"
onDelete="none">
<!-- reference info -->
</foreign-key>
The foreign-key element has 4 attributes associated with it, they are: foreign-key要素は4つの属性を持ちます。それらは:
The foreign-key element can contain the following elements: foreign-key 要素は以下の要素を内包できます:
Element: reference要素: referenceThe reference element and its relevant attributes これはreference要素と関連する属性です。
<reference local="FK_TABLE_ID" foreign="PK_COLUMN_ID"/>
The reference element has 2 attributes associated with it, they are: reference要素は2つの属性を持ちます。それらは:
The reference element can not contain other elements. reference要素は他の要素を含むことはできません。 Element: index要素: indexThe index element and its relevant attributes これはindex要素と関連する属性です。
<index name="MY_INDEX">
<!-- index-column info -->
</index>
The index element has 1 attribute associated with it, it is: index要素は1つの属性を持ちます。それらは:
The index element can contain the following elements: index要素は以下の要素を内包できます:
Element: index-column要素: index-columnThe index-column element and its relevant attributes これはindex-column要素と関連する属性です。
<index-column name="INDEX_COLUMN"/>
The index-column element has 2 attributes associated with it, they are: index-column要素は2つの属性を持ちます。それらは:
The index-column element can not contain other elements. index-column要素は他の要素を含むことはできません。 Element: uniqueThe unique element and its relevant attributes これはunique要素と関連する属性です。
<unique name="MY_UNIQUE">
<!-- unique-column info -->
</unique>
The unique element has 1 attribute associated with it, it is: unique要素は1つの属性を持ちます。それらは:
The unique element can contain the following elements: unique要素は以下の要素を内包できます:
要素: unique-columnThe unique-column element and its relevant attributes これはunique-column要素と関連する属性です。
<index-column name="UNIQUE_COLUMN"/>
The unique-column element has 1 attribute associated with it, it is: unique-column要素は1つの属性を持ちます。それらは:
The unique-column element can not contain other elements. unique-column要素は他の要素を含むことはできません。 |