Torque Database Schema ReferenceTorque データベーススキーマリファレンスTorque was developed as part of the Turbine Framework (version 2.1). It is now decoupled and can be used by itself. Starting with Turbine 2.2 the coupled version of Torque is deprecated. You should upgrade to use the decoupled version. TorqueはTurbineフレームワーク(version 2.1)の一部として開発されました。 現在これは分離され、単独で使用できるようになっています。 バージョン2.2のTurbineは、推奨されないバーションのTorqueが組み込まれています。 このバージョンを使用する場合は分離されたバージョンへアップグレードすべきです。 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"
defaultJavaNamingMethod="underscore">
<table name="SIMPLE">
<!-- table info goes here -->
</table>
</database>
The database element has 6 attributes associated with it, they are:
database要素は6つの属性を持ちます。それらは:
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, ie - 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">
<!-- column information here -->
</table>
The table element has 9 attributes associated with it, they are:
table要素は9の属性を持ちます。それらは:
The table element can contain the following elements:
table要素は以下の要素を内包できます:
Attribute: javaName属性: javaName
This 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名は次の方法で生成されます: 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 9 attributes associated with it, they are:
column要素は9の属性を持ちます。それらは:
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つの属性を持ちます。それらは:
Element: foreign-key要素: foreign-keyThe foreign-key element and its relevant attributes これはforein-key要素と関連する属性です。
<foreign-key foreignTable="MY_TABLE">
<!-- reference info -->
</foreign-key>
The foreign-key element has 1 attribute associated with it, it is:
foreign-key要素は1つの属性を持ちます。それは:
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つの属性を持ちます。それらは:
|