kschrader 01/07/20 13:17:37 Added: docs/howto torque-schema-ref.html Log: Adding this file that got missed in the last commit. Thanks to Sean Legassick for catching it. Revision Changes Path 1.1 jakarta-turbine/docs/howto/torque-schema-ref.html Index: torque-schema-ref.html =================================================================== <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- Content Stylesheet for Site --> <!-- start the processing --> <!-- ====================================================================== --> <!-- Main Page Section --> <!-- ====================================================================== --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <meta name="author" value="Jon S. Stevens"> <meta name="email" value="[EMAIL PROTECTED]"> <meta name="author" value="Warner Onstine"> <meta name="email" value="[EMAIL PROTECTED]"> <title>Turbine - Torque Database Schema Reference</title> </head> <body bgcolor="#ffffff" text="#000000" link="#525D76"> <table border="0" width="100%" cellspacing="0"> <!-- TOP IMAGE --> <tr> <td align="left"> <a href="http://jakarta.apache.org"><img src="http://jakarta.apache.org/images/jakarta-logo.gif" border="0"/></a> </td> <td align="right"> <a href="http://jakarta.apache.org/turbine/"><img src="../images/logo.gif" alt="Turbine" border="0"/></a> </td> </tr> </table> <table border="0" width="100%" cellspacing="4"> <tr><td colspan="2"> <hr noshade="" size="1"/> </td></tr> <tr> <!-- LEFT SIDE NAVIGATION --> <td width="20%" valign="top" nowrap="true"> <p><strong>Essentials</strong></p> <ul> <li> <a href="../index.html">Overview</a> </li> <li> <a href="../features.html">Features</a> </li> <li> <a href="../fsd.html">Specification</a> </li> <li> <a href="../getting-started.html">Getting Started</a> </li> <li> <a href="../further-reading.html">Further Reading</a> </li> </ul> <p><strong>Get Involved</strong></p> <ul> <li> <a href="../contributors.html">Contributors</a> </li> <li> <a href="http://jakarta.apache.org/site/cvsindex.html">CVS Repos</a> </li> <li> <a href="../faq.html">FAQ</a> </li> <li> <a href="http://jakarta.apache.org/site/mail.html">Mailing Lists</a> </li> <li> <a href="../powered.html">Powered by Turbine</a> </li> <li> <a href="../license.html">License</a> </li> <li> <a href="../issue-tracking.html">Issue Tracking</a> </li> </ul> <p><strong>Documentation</strong></p> <ul> <li> <a href="../turbine-documentation-project.html">Turbine Documentation</a> </li> <li> <a href="../turbine-schema.html">Core Schema</a> </li> <li> <a href="../j2ee-integration.html">J2EE Integration</a> </li> <li> <a href="../model2+1.html">Model 2+1</a> </li> <li> <a href="../pullmodel.html">Pull MVC Model</a> </li> <li> <a href="../comma-dot-slash.html">Comma Dot Slash</a> </li> <li> <a href="../services.html">Services</a> </li> </ul> <p><strong>Howto Guides</strong></p> <ul> <li> <a href="../howto/action-event-howto.html">Action Events Howto</a> </li> <li> <a href="../howto/criteria-howto.html">Criteria Howto</a> </li> <li> <a href="../howto/jboss-howto.html">JBoss Howto</a> </li> <li> <a href="../howto/jsp-howto.html">JSP Howto</a> </li> <li> <a href="../howto/mssql-howto.html">MS SQL Server Howto</a> </li> <li> <a href="../howto/oracle-howto.html">Oracle 8i Howto</a> </li> <li> <a href="../howto/peers-howto.html">Peers Howto</a> </li> <li> <a href="../howto/postgres-howto.html">Postgres Howto</a> </li> <li> <a href="../howto/python-howto.html">Python Howto</a> </li> <li> <a href="../howto/security-howto.html">Security Howto</a> </li> <li> <a href="../howto/sybase-howto.html">Sybase Howto</a> </li> <li> <a href="../howto/tdk-howto.html">TDK Howto</a> </li> <li> <a href="../howto/torque-howto.html">Torque Howto</a> </li> <li> <a href="../howto/torque-schema-ref.html">Torque Schema Ref</a> </li> <li> <a href="../howto/velocity-site-howto.html">Velocity Site Howto</a> </li> <li> <a href="../howto/context-howto.html">Velocity Context Howto</a> </li> <li> <a href="../howto/webmacro-site-howto.html">Webmacro Site Howto</a> </li> </ul> <p><strong>Development</strong></p> <ul> <li> <a href="../active-developers.html">Active Developers</a> </li> <li> <a href="../changes.html">Changes</a> </li> <li> <a href="../code-standards.html">Coding Specification</a> </li> <li> <a href="../branches.html">CVS Branches</a> </li> <li> <a href="../db-adapters.html">DB Adapters</a> </li> <li> <a href="../deprecation.html">Deprecation Rules</a> </li> <li> <a href="../project-map.html">Project Map</a> </li> <li> <a href="../proposals.html">Proposals</a> </li> <li> <a href="../todo.html">Todo</a> </li> </ul> </td> <td width="80%" align="left" valign="top"> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#525D76"> <font color="#ffffff" face="arial,helvetica,sanserif"> <a name="Torque Database Schema Reference"><strong>Torque Database Schema Reference</strong></a> </font> </td></tr> <tr><td> <blockquote> <p> 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. </p> </blockquote> </p> </td></tr> <tr><td><br/></td></tr> </table> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#525D76"> <font color="#ffffff" face="arial,helvetica,sanserif"> <a name="Elements and their attributes"><strong>Elements and their attributes</strong></a> </font> </td></tr> <tr><td> <blockquote> <p> Some of the following examples are taken from the project-schema.xml document in the src/conf/torque/schema. </p> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#828DA6"> <font color="#ffffff" face="arial,helvetica,sanserif"> <a name="Element: database"><strong>Element: database</strong></a> </font> </td></tr> <tr><td> <blockquote> <p>The database element and its relevant attributes.</p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre> <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> </pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> The database element has 5 attributes associated with it, they are: <ul> <li>name - The name of the database being referenced</li> <li>defaultIdMethod - How will the primary keys be created, defaults to "none"</li> <li>package - used for OM Peer generation</li> <li>baseClass - used for OM generation</li> <li>basePeer - used for OM Peer generation</li> </ul> The last four will be explained in detail below. </p> <p> The database element can contain the following elements: <ul> <li>table - one or more</li> </ul> </p> </blockquote> </td></tr> <tr><td><br/></td></tr> </table> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#828DA6"> <font color="#ffffff" face="arial,helvetica,sanserif"> <a name="Attribute: defaultIdMethod"><strong>Attribute: defaultIdMethod</strong></a> </font> </td></tr> <tr><td> <blockquote> <p> 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: <ul> <li>idbroker - This allows turbine to generate the IDs through its IDBroker Service</li> <li>native - Turbine will determine how the database will auto-generate IDs</li> <li>autoincrement - deprecated, please use native</li> <li>sequence - deprecated, please use native</li> <li>none - Typically used if you do not want IDs generated</li> </ul> </p> </blockquote> </td></tr> <tr><td><br/></td></tr> </table> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#828DA6"> <font color="#ffffff" face="arial,helvetica,sanserif"> <a name="Attribute: package"><strong>Attribute: package</strong></a> </font> </td></tr> <tr><td> <blockquote> <p> 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. </p> </blockquote> </td></tr> <tr><td><br/></td></tr> </table> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#828DA6"> <font color="#ffffff" face="arial,helvetica,sanserif"> <a name="Attribute: baseClass"><strong>Attribute: baseClass</strong></a> </font> </td></tr> <tr><td> <blockquote> <p> The base class to use when generating the Object Model. This class does not have to extend org.apache.turbine.om.BaseObject. </p> </blockquote> </td></tr> <tr><td><br/></td></tr> </table> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#828DA6"> <font color="#ffffff" face="arial,helvetica,sanserif"> <a name="Attribute: basePeer"><strong>Attribute: basePeer</strong></a> </font> </td></tr> <tr><td> <blockquote> <p> The 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. </p> </blockquote> </td></tr> <tr><td><br/></td></tr> </table> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#828DA6"> <font color="#ffffff" face="arial,helvetica,sanserif"> <a name="Element: table"><strong>Element: table</strong></a> </font> </td></tr> <tr><td> <blockquote> <p>The table element and its relevant attributes</p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre> <table name="MY_TABLE" javaName="table" idMethod="idbroker" skipSql="false" baseClass="com.myapp.om.table.BaseClass" basePeer="com.myapp.om.table.BasePeer"> <!-- column information here --> </table> </pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> The table element has 8 attributes associated with it, they are: <ul> <li>name - The name of the database being referenced</li> <li>javaName - How this table will be referenced in java</li> <li>idMethod - How will the primary keys be created, defaults to "none"</li> <li>skipSql - Whether or not to skip SQL generation for this reference</li> <li>abstract - Whether or not to generate the class as Abstract or not</li> <li>alias - The table alias</li> <li>baseClass - used for OM Peer generation</li> <li>basePeer - used for OM Peer generation</li> </ul> </p> <p> The table element can contain the following elements: <ul> <li>column - one or more</li> <li>foreign-key - 0 or more</li> <li>index - 0 or more</li> <li>unique - 0 or more</li> <li>id-method-parameter - 0 or more</li> </ul> </p> </blockquote> </td></tr> <tr><td><br/></td></tr> </table> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#828DA6"> <font color="#ffffff" face="arial,helvetica,sanserif"> <a name="Attribute: javaName"><strong>Attribute: javaName</strong></a> </font> </td></tr> <tr><td> <blockquote> <p> 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:<br /> 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. </p> </blockquote> </td></tr> <tr><td><br/></td></tr> </table> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#828DA6"> <font color="#ffffff" face="arial,helvetica,sanserif"> <a name="Element: column"><strong>Element: column</strong></a> </font> </td></tr> <tr><td> <blockquote> <p>The column element and its relevant attributes</p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre> <column name="MY_COLUMN" javaName="Column" primaryKey="true" required="true" size="4" type="VARCHAR"> <!-- inheritance info if necessary --> </column> </pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> The column element has 8 attributes associated with it, they are: <ul> <li>name - The name of the column being referenced</li> <li>javaName - How this column will be referred to in Java</li> <li>primaryKey - Is this a primary key or not (true or false)</li> <li>required - Whether a value is required in this field (true or false)</li> <li>type - What type of column is it? (Covered below), defaults to VARCHAR</li> <li>size - How many characters or digits can be stored?</li> <li>default - Default value to insert into field if it is missing.</li> <li>autoIncrement - Whether or not to auto-increment this field, defaults to "false"</li> <li>inheritance - ?</li> <li>inputValidator - ?</li> </ul> </p> <p> The column element can contain the following elements: <ul> <li>inheritance - 0 or more</li> </ul> </p> </blockquote> </td></tr> <tr><td><br/></td></tr> </table> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#828DA6"> <font color="#ffffff" face="arial,helvetica,sanserif"> <a name="Element: inheritance"><strong>Element: inheritance</strong></a> </font> </td></tr> <tr><td> <blockquote> <p>The inheritance element and its relevant attributes</p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre> <inheritance key="key" class="classname" extends="mybase"/> </pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> The inheritance element has 3 attributes associated with it, they are: <ul> <li>key - ?</li> <li>class - ?</li> <li>extends - ?</li> </ul> </p> </blockquote> </td></tr> <tr><td><br/></td></tr> </table> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#828DA6"> <font color="#ffffff" face="arial,helvetica,sanserif"> <a name="Element: foreign-key"><strong>Element: foreign-key</strong></a> </font> </td></tr> <tr><td> <blockquote> <p>The foreign-key element and its relevant attributes</p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre> <foreign-key foreignTable="MY_TABLE"> <!-- reference info --> </foreign-key> </pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> The foreign-key element has 1 attribute associated with it, it is: <ul> <li>foreignTable - the name of the table being referenced</li> </ul> </p> <p> The foreign-key element can contain the following elements: <ul> <li>reference - 1 or more</li> </ul> </p> </blockquote> </td></tr> <tr><td><br/></td></tr> </table> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#828DA6"> <font color="#ffffff" face="arial,helvetica,sanserif"> <a name="Element: reference"><strong>Element: reference</strong></a> </font> </td></tr> <tr><td> <blockquote> <p>The reference element and its relevant attributes</p> <div align="left"> <table cellspacing="4" cellpadding="0" border="0"> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#ffffff"><pre> <reference local="FK_TABLE_ID" foreign="PK_COLUMN_ID"/> </pre></td> <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> <tr> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td> </tr> </table> </div> <p> The reference element has 2 attributes associated with it, they are: <ul> <li>local - the local reference</li> <li>foreign - the foreign key reference</li> </ul> </p> </blockquote> </td></tr> <tr><td><br/></td></tr> </table> </blockquote> </p> </td></tr> <tr><td><br/></td></tr> </table> </td> </tr> <!-- FOOTER --> <tr><td colspan="2"> <hr noshade="" size="1"/> </td></tr> <tr><td colspan="2"> <div align="center"><font color="#525D76" size="-1"><em> Copyright © 1999-2001, Apache Software Foundation </em></font></div> </td></tr> </table> </body> </html> <!-- end the processing --> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
