|
Torque
Guides
Howto Guides
Development
|
|
Torque Schema Reference
|
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.
|
|
|
Elements and their attributes
|
Some of the following examples are taken from the project-schema.xml
document in the src/conf/torque/schema.
|
Attribute: defaultIdMethod
|
By 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:
| idbroker |
This allows turbine to generate the IDs through its IDBroker
Service |
| native |
Turbine will determine how the database will auto-generate
IDs |
| autoincrement |
deprecated, please use native |
| sequence |
deprecated, please use native |
| none |
Typically used if you do not want IDs generated |
|
|
|
Attribute: defaultJavaNamingMethod
|
This 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:
| nochange |
Indicates no 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.
|
|
|
|
Attribute: package
|
The 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.
|
|
|
Attribute: baseClass
|
The base class to use when generating the Object Model.
This class does not have to extend org.apache.turbine.om.BaseObject.
|
|
|
Attribute: basePeer
|
The 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.
|
|
|
Attribute: 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:
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.
|
|
|
|
|