db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1436782 [1/2] - in /db/torque/torque4/trunk/torque-test: ./ src/main/schema/ src/test/java/org/apache/torque/ src/test/java/org/apache/torque/datatypes/ src/test/java/org/apache/torque/generated/dataobject/ src/test/java/org/apache/torque/...
Date Tue, 22 Jan 2013 07:51:32 GMT
Author: tfischer
Date: Tue Jan 22 07:51:31 2013
New Revision: 1436782

URL: http://svn.apache.org/viewvc?rev=1436782&view=rev
Log:
TORQUE-251 fix SQL errors in the test project
- remove unused test tables
- use naming schema for similar tables
- test on update and on delete clauses

Modified:
    db/torque/torque4/trunk/torque-test/pom.xml
    db/torque/torque4/trunk/torque-test/src/main/schema/bookstore-schema.xml
    db/torque/torque4/trunk/torque-test/src/main/schema/databaseMapInit-schema.xml
    db/torque/torque4/trunk/torque-test/src/main/schema/foreign-key-schema.xml
    db/torque/torque4/trunk/torque-test/src/main/schema/pk-schema.xml
    db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml
    db/torque/torque4/trunk/torque-test/src/main/schema/types-schema.xml
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ForeignKeySchemaData.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/InitShutdownTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BooleanIntCharTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/SaveTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/DateTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/JoinTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/map/DatabaseMapTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/om/OMByNameMethodsTest.java

Modified: db/torque/torque4/trunk/torque-test/pom.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/pom.xml?rev=1436782&r1=1436781&r2=1436782&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/pom.xml (original)
+++ db/torque/torque4/trunk/torque-test/pom.xml Tue Jan 22 07:51:31 2013
@@ -118,6 +118,9 @@
                     <filter token="DATABASE_DEFAULT" value="bookstore" />
                     <filter token="DATABASE_ID_METHOD" value="${torque.test.idmethod}" />
                     <filter token="DATABASE_SCHEMA" value="${torque.test.databaseSchema}" />
+                    <filter token="ON_UPDATE_CASCADE" value="${torque.test.onUpdateCascade}" />
+                    <filter token="ON_UPDATE_SETNULL" value="${torque.test.onUpdateSetNull}" />
+                    <filter token="BIT_DATA_TYPE" value="${torque.test.bitDataType}" />
                   </filterset>
                 </copy>
                 <delete dir="target/torque/test/sql" />
@@ -359,6 +362,9 @@
                 <includes>
                   <include>*idtable-init.sql</include>
                 </includes>
+                <excludes>
+                  <exclude>included-*-idtable-init.sql</exclude>
+                </excludes>
               </fileset>
             </configuration>
           </execution>
@@ -400,9 +406,13 @@
               <name>torque.configuration.file</name>
               <value>src/test/profile/${torque.test.profileDirectory}/Torque.properties</value>
             </property>
+            <property>
+                <name>derby.stream.error.file</name>
+                <value>target/derby.log</value>
+            </property>
           </systemProperties>
         </configuration>
-      </plugin>      
+      </plugin>
 
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
@@ -473,6 +483,9 @@
         <torque.test.profileDirectory>derbyEmbedded</torque.test.profileDirectory>
         <torque.test.idmethod>native</torque.test.idmethod>
         <torque.test.databaseSchema>bookstore</torque.test.databaseSchema>
+        <torque.test.onUpdateCascade></torque.test.onUpdateCascade>
+        <torque.test.onUpdateSetNull></torque.test.onUpdateSetNull>
+        <torque.test.bitDataType>VARCHAR</torque.test.bitDataType><!-- BIT if database supports bIT type, something else if not -->
         <torque.driver>org.apache.derby.jdbc.EmbeddedDriver</torque.driver>
         <torque.targetDatabase>derby</torque.targetDatabase>
         <torque.database.url>jdbc:derby:target/bookstore;create=true</torque.database.url>
@@ -519,6 +532,9 @@
         <torque.test.profileDirectory>hsqldb</torque.test.profileDirectory>
         <torque.test.idmethod>idbroker</torque.test.idmethod>
         <torque.test.databaseSchema>torque_schema</torque.test.databaseSchema>
+        <torque.test.onUpdateCascade>onUpdate="cascade"</torque.test.onUpdateCascade>
+        <torque.test.onUpdateSetNull>onUpdate="setnull"</torque.test.onUpdateSetNull>
+        <torque.test.bitDataType>BIT</torque.test.bitDataType><!-- BIT if database supports bIT type, something else if not -->
         <torque.driver>org.hsqldb.jdbcDriver</torque.driver>
         <torque.targetDatabase>hsqldb</torque.targetDatabase>
         <torque.database.url>jdbc:hsqldb:target/sqltest;shutdown=true</torque.database.url>
@@ -566,6 +582,9 @@
         <torque.test.profileDirectory>hsqldb</torque.test.profileDirectory>
         <torque.test.idmethod>idbroker</torque.test.idmethod>
         <torque.test.databaseSchema>torque_schema</torque.test.databaseSchema>
+        <torque.test.onUpdateCascade>onUpdate="cascade"</torque.test.onUpdateCascade>
+        <torque.test.onUpdateSetNull>onUpdate="setnull"</torque.test.onUpdateSetNull>
+        <torque.test.bitDataType>BIT</torque.test.bitDataType><!-- BIT if database supports bIT type, something else if not -->
         <torque.driver>org.hsqldb.jdbcDriver</torque.driver>
         <torque.targetDatabase>hsqldb</torque.targetDatabase>
         <torque.database.url>jdbc:hsqldb:torque-test/target/sqltest;shutdown=true</torque.database.url>
@@ -608,6 +627,9 @@
         <torque.test.profileDirectory>derby</torque.test.profileDirectory>
         <torque.test.idmethod>native</torque.test.idmethod>
         <torque.test.databaseSchema>bookstore</torque.test.databaseSchema>
+        <torque.test.onUpdateCascade>onUpdate="cascade"</torque.test.onUpdateCascade>
+        <torque.test.onUpdateSetNull>onUpdate="setnull"</torque.test.onUpdateSetNull>
+        <torque.test.bitDataType>BIT</torque.test.bitDataType><!-- BIT if database supports bIT type, something else if not -->
         <torque.driver>org.apache.derby.jdbc.ClientDriver</torque.driver>
         <torque.targetDatabase>derby</torque.targetDatabase>
         <torque.database.url>jdbc:derby://localhost:1527/bookstore;create=true</torque.database.url>
@@ -650,6 +672,9 @@
         <torque.test.profileDirectory>mysql</torque.test.profileDirectory>
         <torque.test.idmethod>native</torque.test.idmethod>
         <torque.test.databaseSchema>bookstore</torque.test.databaseSchema>
+        <torque.test.onUpdateCascade>onUpdate="cascade"</torque.test.onUpdateCascade>
+        <torque.test.onUpdateSetNull>onUpdate="setnull"</torque.test.onUpdateSetNull>
+        <torque.test.bitDataType>BIT</torque.test.bitDataType><!-- BIT if database supports bIT type, something else if not -->
         <torque.driver>org.gjt.mm.mysql.Driver</torque.driver>
         <torque.targetDatabase>mysql</torque.targetDatabase>
         <torque.database.url>jdbc:mysql://localhost:3306/bookstore</torque.database.url>
@@ -692,6 +717,9 @@
         <torque.test.profileDirectory>mssql</torque.test.profileDirectory>
         <torque.test.idmethod>native</torque.test.idmethod>
         <torque.test.databaseSchema>torque_schema</torque.test.databaseSchema>
+        <torque.test.onUpdateCascade>onUpdate="cascade"</torque.test.onUpdateCascade>
+        <torque.test.onUpdateSetNull>onUpdate="setnull"</torque.test.onUpdateSetNull>
+        <torque.test.bitDataType>BIT</torque.test.bitDataType><!-- BIT if database supports bIT type, something else if not -->
         <torque.driver>net.sourceforge.jtds.jdbc.Driver</torque.driver>
         <torque.targetDatabase>mssql</torque.targetDatabase>
         <torque.database.url>jdbc:jtds:sqlserver://localhost:1433/torque</torque.database.url>
@@ -734,6 +762,9 @@
         <torque.test.profileDirectory>oracle</torque.test.profileDirectory>
         <torque.test.idmethod>native</torque.test.idmethod>
         <torque.test.databaseSchema>torque</torque.test.databaseSchema>
+        <torque.test.onUpdateCascade>onUpdate="cascade"</torque.test.onUpdateCascade>
+        <torque.test.onUpdateSetNull>onUpdate="setnull"</torque.test.onUpdateSetNull>
+        <torque.test.bitDataType>BIT</torque.test.bitDataType><!-- BIT if database supports bIT type, something else if not -->
         <torque.driver>oracle.jdbc.driver.OracleDriver</torque.driver>
         <torque.targetDatabase>oracle</torque.targetDatabase>
         <torque.database.url>jdbc:oracle:thin:@localhost:1521:XE</torque.database.url>
@@ -776,6 +807,9 @@
         <torque.test.profileDirectory>postgresql</torque.test.profileDirectory>
         <torque.test.idmethod>idbroker</torque.test.idmethod>
         <torque.test.databaseSchema>bookstore</torque.test.databaseSchema>
+        <torque.test.onUpdateCascade>onUpdate="cascade"</torque.test.onUpdateCascade>
+        <torque.test.onUpdateSetNull>onUpdate="setnull"</torque.test.onUpdateSetNull>
+        <torque.test.bitDataType>BIT</torque.test.bitDataType><!-- BIT if database supports bIT type, something else if not -->
         <torque.driver>org.postgresql.Driver</torque.driver>
         <torque.targetDatabase>postgresql</torque.targetDatabase>
         <torque.database.url>jdbc:postgresql://localhost:5432/bookstore</torque.database.url>
@@ -818,6 +852,9 @@
         <torque.test.profileDirectory>tv</torque.test.profileDirectory>
         <torque.test.idmethod>idbroker</torque.test.idmethod>
         <torque.test.databaseSchema>bookstore</torque.test.databaseSchema>
+        <torque.test.onUpdateCascade>onUpdate="cascade"</torque.test.onUpdateCascade>
+        <torque.test.onUpdateSetNull>onUpdate="setnull"</torque.test.onUpdateSetNull>
+        <torque.test.bitDataType>BIT</torque.test.bitDataType><!-- BIT if database supports bIT type, something else if not -->
         <torque.driver>org.gjt.mm.mysql.Driver</torque.driver>
         <torque.targetDatabase>mysql</torque.targetDatabase>
         <torque.database.url>jdbc:mysql://gatekeeper.home.lan:3306/bookstore</torque.database.url>
@@ -857,6 +894,9 @@
         <torque.test.profileDirectory>derbyEmbedded</torque.test.profileDirectory>
         <torque.test.idmethod>native</torque.test.idmethod>
         <torque.test.databaseSchema>bookstore</torque.test.databaseSchema>
+        <torque.test.onUpdateCascade>onUpdate="cascade"</torque.test.onUpdateCascade>
+        <torque.test.onUpdateSetNull>onUpdate="setnull"</torque.test.onUpdateSetNull>
+        <torque.test.bitDataType>VARCHAR</torque.test.bitDataType><!-- BIT if database supports bIT type, something else if not -->
         <torque.driver>org.apache.derby.jdbc.EmbeddedDriver</torque.driver>
         <torque.targetDatabase>derby</torque.targetDatabase>
         <torque.database.url>jdbc:derby:torque-test/target/bookstore;create=true</torque.database.url>

Modified: db/torque/torque4/trunk/torque-test/src/main/schema/bookstore-schema.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/bookstore-schema.xml?rev=1436782&r1=1436781&r2=1436782&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/main/schema/bookstore-schema.xml (original)
+++ db/torque/torque4/trunk/torque-test/src/main/schema/bookstore-schema.xml Tue Jan 22 07:51:31 2013
@@ -85,207 +85,6 @@
 
   </table>
 
-
-  <!-- =================================================== -->
-  <!-- T E S T   T A B L E                                 -->
-  <!-- =================================================== -->
-
-  <!-- TRQS51 Datadump does not recognize null columns properly -->
-  <table name="NULL_VALUE_TABLE"
-         description="table containing null values to test datadump">
-    <column name="NULL_VALUE_TABLE_ID" primaryKey="true" required="true" type="INTEGER"/>
-    <column name="number1" type="INTEGER"/>
-    <column name="number2" type="INTEGER"/>
-    <column name="number3" type="INTEGER"/>
-    <column name="text1" type="VARCHAR" size="20"/>
-    <column name="text2" type="VARCHAR" size="20"/>
-    <column name="number_obj1" type="INTEGER" javaType="object"/>
-    <column name="number_obj2" type="INTEGER" javaType="object"/>
-
-  </table>
-
-
-  <!-- =================================================== -->
-  <!-- A  T A B L E                                        -->
-  <!-- =================================================== -->
-
-  <table name="a" description="A table">
-    <column
-      name="a_id"
-      required="true"
-      primaryKey="true"
-      type="INTEGER"
-    />
-    <column
-      name="name"
-      required="true"
-      type="VARCHAR"
-      size="50"
-    />
-
-  </table>
-
-  <!-- =================================================== -->
-  <!-- B  T A B L E                                        -->
-  <!-- =================================================== -->
-
-  <table name="b" description="B table">
-    <column
-      name="b_id"
-      required="true"
-      primaryKey="true"
-      type="INTEGER"
-    />
-    <column
-      name="name"
-      required="true"
-      type="VARCHAR"
-      size="50"
-    />
-
-  </table>
-
-
-  <!-- =================================================== -->
-  <!-- AB  T A B L E                                       -->
-  <!-- =================================================== -->
-
-  <table name="r_ab" description="r_ab table" idMethod="none">
-    <column
-      name="a_id"
-      required="true"
-      primaryKey="true"
-      type="INTEGER"
-    />
-    <column
-      name="b_id"
-      required="true"
-      primaryKey="true"
-      type="INTEGER"
-    />
-    <column
-      name="name"
-      required="true"
-      type="VARCHAR"
-      size="50"
-    />
-
-    <foreign-key foreignTable="a">
-      <reference local="a_id" foreign="a_id"/>
-    </foreign-key>
-
-    <foreign-key foreignTable="b">
-      <reference local="b_id" foreign="b_id"/>
-    </foreign-key>
-
-  </table>
-
-  <!-- =================================================== -->
-  <!-- C  T A B L E                                       -->
-  <!-- =================================================== -->
-
-  <table name="c" description="c table contains fk to ar_ab, a and b">
-    <column
-      name="c_id"
-      required="true"
-      primaryKey="true"
-      type="INTEGER"
-    />
-    <column
-      name="a_id"
-      required="true"
-      type="INTEGER"
-    />
-    <column
-      name="b_id"
-      required="true"
-      type="INTEGER"
-    />
-    <column
-      name="name"
-      required="true"
-      type="VARCHAR"
-      size="50"
-    />
-
-    <foreign-key foreignTable="r_ab">
-      <reference local="a_id" foreign="a_id"/>
-      <reference local="b_id" foreign="b_id"/>
-    </foreign-key>
-
-    <foreign-key foreignTable="a">
-      <reference local="a_id" foreign="a_id"/>
-    </foreign-key>
-
-    <foreign-key foreignTable="b">
-      <reference local="b_id" foreign="b_id"/>
-    </foreign-key>
-
-  </table>
-
-
-  <table name="d" idMethod="none">
-    <column name="d_id" required="true"
-            primaryKey="true" type="INTEGER"/>
-    <column name="name" required="true" size="255" type="VARCHAR"/>
-    <column name="b_id" primaryKey="true" required="true" type="INTEGER"/>
-    <column name="a_id" primaryKey="true" required="true" type="INTEGER"/>
-    <foreign-key foreignTable="a">
-        <reference local="a_id" foreign="a_id"/>
-    </foreign-key>
-    <foreign-key foreignTable="r_ab">
-        <reference local="a_id" foreign="a_id"/>
-        <reference local="b_id" foreign="b_id"/>
-    </foreign-key>
-  </table>
-
-  <table name="MULTIPK_SELF_REFTABLE" idMethod="none">
-    <column name="COL1" primaryKey="true" required="true" type="DECIMAL"/>
-    <column name="COL2" primaryKey="true" required="true" type="DECIMAL"/>
-
-    <column name="PARENT_COL1" required="true" type="DECIMAL"/>
-    <column name="PARENT_COL2" required="true" type="DECIMAL"/>
-
-    <foreign-key foreignTable="MULTIPK_SELF_REFTABLE">
-      <reference foreign="COL1" local="PARENT_COL1"/>
-      <reference foreign="COL2" local="PARENT_COL2"/>
-    </foreign-key>
-  </table>
-
-  <!-- =================================================== -->
-  <!-- T A B L E  W I T H  I N T E R F A C E               -->
-  <!-- =================================================== -->
-
-  <table name="ifc_table" idMethod="none"
-  	interface="org.apache.torque.TestInterface"
-  	description="this table implements an interface">
-    <column
-      name="id" javaName="ID"
-      primaryKey="true" required="true"
-      type="INTEGER"
-    />
-    <column
-      name="name" javaName="Name"
-      type="VARCHAR"
-      size="50"
-    />
-  </table>
-
-  <table name="ifc_table2" idMethod="none"
-  	interface="LocalTestInterface"
-  	description="this table implements a local interface">
-    <column
-      name="id" javaName="ID"
-      primaryKey="true" required="true"
-      type="INTEGER"
-    />
-    <column
-      name="name" javaName="Name"
-      type="VARCHAR"
-      size="50"
-    />
-  </table>
-
   <!-- =================================================== -->
   <!-- B O O K _ A U T H O R  V I E W                      -->
   <!-- =================================================== -->

Modified: db/torque/torque4/trunk/torque-test/src/main/schema/databaseMapInit-schema.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/databaseMapInit-schema.xml?rev=1436782&r1=1436781&r2=1436782&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/main/schema/databaseMapInit-schema.xml (original)
+++ db/torque/torque4/trunk/torque-test/src/main/schema/databaseMapInit-schema.xml Tue Jan 22 07:51:31 2013
@@ -19,7 +19,7 @@
 -->
 <!-- this schema is used to test problems users reported -->
 
-<database name="databaseMapInit" 
+<database name="databaseMap" 
     defaultIdMethod="@DATABASE_ID_METHOD@">
 
   <option key="databaseOptionKey1" value="databaseOptionValue1"/>
@@ -66,19 +66,8 @@
       basePeerPackage="org.apache.torque.test.base"
       recordMapperPackage="org.apache.torque.test"
       baseRecordMapperPackage="org.apache.torque.test.base">
-    <column
-      name="id"
-      required="true"
-      primaryKey="true"
-      type="INTEGER"
-      protected="true"
-    />
-    <column
-      name="name"
-      required="true"
-      type="VARCHAR"
-      size="50"
-      protected="true"
+    <column name="id" primaryKey="true" type="INTEGER" protected="true" />
+    <column name="name" type="VARCHAR" size="50" protected="true"
     />
   </table>
 </database>

Modified: db/torque/torque4/trunk/torque-test/src/main/schema/foreign-key-schema.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/foreign-key-schema.xml?rev=1436782&r1=1436781&r2=1436782&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/main/schema/foreign-key-schema.xml (original)
+++ db/torque/torque4/trunk/torque-test/src/main/schema/foreign-key-schema.xml Tue Jan 22 07:51:31 2013
@@ -34,6 +34,9 @@
     <column name="ID" primaryKey="true" type="INTEGER" javaType="primitive"/>
     <column name="INTEGER_COLUMN" type="INTEGER" javaType="primitive"/>
     <column name="NAME" type="VARCHAR" size="100"/>
+    <unique name="P_INTEGER_PK_UNQ">
+      <unique-column name="INTEGER_COLUMN"/>
+    </unique>
   </table>
 
   <table name="NULLABLE_P_INTEGER_FK"
@@ -53,7 +56,9 @@
     <column name="ID" primaryKey="true" type="INTEGER" javaType="primitive"/>
     <column name="FK" required="true" type="INTEGER" javaType="primitive"/>
     <column name="NAME" type="VARCHAR" size="100"/>
-    <foreign-key foreignTable="P_INTEGER_PK">
+    <foreign-key foreignTable="P_INTEGER_PK" 
+        @ON_UPDATE_CASCADE@
+        onDelete="cascade">
       <reference local="FK" foreign="ID"/>
     </foreign-key>
   </table>
@@ -76,7 +81,9 @@
     <column name="ID" primaryKey="true" type="INTEGER" javaType="primitive"/>
     <column name="FK" required="true" type="INTEGER" javaType="primitive"/>
     <column name="NAME" type="VARCHAR" size="100"/>
-    <foreign-key foreignTable="P_INTEGER_PK">
+    <foreign-key foreignTable="P_INTEGER_PK"
+        onUpdate="restrict"
+        onDelete="restrict">
       <reference local="FK" foreign="INTEGER_COLUMN"/>
     </foreign-key>
   </table>
@@ -97,6 +104,9 @@
     <column name="ID" primaryKey="true" type="INTEGER" javaType="object"/>
     <column name="INTEGER_COLUMN" type="INTEGER" javaType="object"/>
     <column name="NAME" type="VARCHAR" size="100"/>
+    <unique name="O_INTEGER_PK_UNQ">
+      <unique-column name="INTEGER_COLUMN"/>
+    </unique>
   </table>
 
   <table name="NULLABLE_O_INTEGER_FK"
@@ -105,7 +115,9 @@
     <column name="ID" primaryKey="true" type="INTEGER" javaType="object"/>
     <column name="FK" type="INTEGER" javaType="object"/>
     <column name="NAME" type="VARCHAR" size="100"/>
-    <foreign-key foreignTable="O_INTEGER_PK">
+    <foreign-key foreignTable="O_INTEGER_PK"
+        @ON_UPDATE_SETNULL@
+        onDelete="setnull">
       <reference local="FK" foreign="ID"/>
     </foreign-key>
   </table>
@@ -155,6 +167,44 @@
     </foreign-key>
   </table>
 
+  <table name="MULTI_REF_SAME_TABLE" 
+      description="Table to test multiple references to a same table"
+      idMethod="none">
+    <column name="ID" primaryKey="true" type="INTEGER"/>
+    <column name="REFERENCE_1" type="INTEGER"/>
+    <column name="REFERENCE_2" type="INTEGER"/>
+    <column name="REFERENCE_3" type="INTEGER"/>
+    <column name="NAME" type="VARCHAR" size="100"/>
+    <foreign-key foreignTable="O_INTEGER_PK">
+      <reference local="REFERENCE_1" foreign="ID"/>
+    </foreign-key>
+    <foreign-key foreignTable="O_INTEGER_PK">
+      <reference local="REFERENCE_2" foreign="ID"/>
+    </foreign-key>
+    <foreign-key foreignTable="O_INTEGER_PK">
+      <reference local="REFERENCE_3" foreign="ID"/>
+    </foreign-key>
+  </table>
+
+  <table name="MULTI_REF" 
+      description="Table to test multiple references to different tables"
+      idMethod="none">
+    <column name="ID" primaryKey="true" type="INTEGER"/>
+    <column name="O_INTEGER_PK_ID" type="INTEGER"/>
+    <column name="P_INTEGER_PK_ID" type="INTEGER"/>
+    <column name="NULLABLE_O_INTEGER_FK_ID" type="INTEGER"/>
+    <column name="NAME" type="VARCHAR" size="100"/>
+    <foreign-key foreignTable="O_INTEGER_PK">
+      <reference local="O_INTEGER_PK_ID" foreign="ID"/>
+    </foreign-key>
+    <foreign-key foreignTable="P_INTEGER_PK">
+      <reference local="P_INTEGER_PK_ID" foreign="ID"/>
+    </foreign-key>
+    <foreign-key foreignTable="NULLABLE_O_INTEGER_FK">
+      <reference local="NULLABLE_O_INTEGER_FK_ID" foreign="ID"/>
+    </foreign-key>
+  </table>
+
   <table name="COMP_PK_OTHER_FK" idMethod="none"
       description="table with a composite primary key which does not contain 
           the foreign key column which references the non-composite 
@@ -188,6 +238,10 @@
     <column name="INTEGER_COLUMN" type="INTEGER" javaType="object"/>
     <column name="VARCHAR_COLUMN" type="VARCHAR" size="50"/>
     <column name="NAME" type="VARCHAR" size="100"/>
+    <unique name="COMP_INTEGER_VARCHAR_PK_UNQ">
+      <unique-column name="INTEGER_COLUMN"/>
+      <unique-column name="VARCHAR_COLUMN"/>
+    </unique>
   </table>
 
   <table name="COMP_INTEGER_VARCHAR_FK"
@@ -217,4 +271,19 @@
     </foreign-key>
   </table>
 
+  <table name="CIRCULAR_REFERENCE_A" description="Table to test circular references">
+    <column name="ID" primaryKey="true" type="INTEGER" />
+    <column name="CIRCULAR_REFERENCE_B_ID" type="INTEGER" />
+    <foreign-key foreignTable="CIRCULAR_REFERENCE_B">
+      <reference local="CIRCULAR_REFERENCE_B_ID" foreign="ID"/>
+    </foreign-key>
+  </table>
+  
+  <table name="CIRCULAR_REFERENCE_B" description="Table to test circular references">
+    <column name="ID" primaryKey="true" type="INTEGER" />
+    <column name="CIRCULAR_REFERENCE_A_ID" type="INTEGER" required="false" />
+    <foreign-key foreignTable="CIRCULAR_REFERENCE_A">
+      <reference  local="CIRCULAR_REFERENCE_A_ID" foreign="ID"/>
+    </foreign-key>
+  </table>
 </database>

Modified: db/torque/torque4/trunk/torque-test/src/main/schema/pk-schema.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/pk-schema.xml?rev=1436782&r1=1436781&r2=1436782&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/main/schema/pk-schema.xml (original)
+++ db/torque/torque4/trunk/torque-test/src/main/schema/pk-schema.xml Tue Jan 22 07:51:31 2013
@@ -32,25 +32,15 @@
     <column name="NAME" type="VARCHAR" size="50" />
   </table>
 
-  <table name="TINYINT_PK">
-    <column name="ID" primaryKey="true" type="TINYINT" />
-    <column name="NAME" type="CHAR" size="50"/>
-  </table>
+  <!-- most types pk are defined in the type schema -->
 
-  <table name="SMALLINT_PK">
-    <column name="ID" primaryKey="true" type="SMALLINT" />
+  <table name="DATE_PK" idMethod="none">
+    <column name="ID" primaryKey="true" type="DATE" />
     <column name="NAME" type="CHAR" size="50"/>
   </table>
-  
-  <!--  Integer keys are defined in foreign key schema -->
 
-  <table name="VARCHAR_PK" idMethod="none">
-    <column name="ID" primaryKey="true" type="VARCHAR" size="30" />
-    <column name="NAME" type="CHAR" size="50"/>
-  </table>
-
-  <table name="VARCHAR_PK" idMethod="none">
-    <column name="ID" primaryKey="true" type="VARCHAR" size="30" />
+  <table name="TIME_PK" idMethod="none">
+    <column name="ID" primaryKey="true" type="TIME" />
     <column name="NAME" type="CHAR" size="50"/>
   </table>
 
@@ -59,23 +49,6 @@
     <column name="NAME" type="CHAR" size="50"/>
   </table>
 
-  <table name="FLOAT_PK" idMethod="none">
-    <column name="ID" primaryKey="true" type="FLOAT" />
-  </table>
-
-  <table name="REAL_PK" idMethod="none">
-    <column name="ID" primaryKey="true" type="REAL" />
-  </table>
-
-  <table name="DOUBLE_PK" idMethod="none">
-    <column name="ID" primaryKey="true" type="DOUBLE" />
-  </table>
-
-  <table name="LARGE_PK" idMethod="none" description="Table to test large Primary keys">
-    <column name="ID" primaryKey="true" type="BIGINT" />
-    <column name="NAME" type="VARCHAR" size="50" />
-  </table>
-
   <table name="BIT_COMPOSITE_PK" idMethod="none">
     <column name="PK1" primaryKey="true" type="VARCHAR" size="50"/>
     <column name="PK2" primaryKey="true" type="BIT" javaType="object"/>

Modified: db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml?rev=1436782&r1=1436781&r2=1436782&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml (original)
+++ db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml Tue Jan 22 07:51:31 2013
@@ -17,53 +17,22 @@
  specific language governing permissions and limitations
  under the License.
 -->
-<!-- this schema is used to test problems users reported -->
+<!-- this schema is used to test various stuff which does not fit into the 
+     other tested categories -->
 
 <database name="@DATABASE_DEFAULT@" 
     defaultIdMethod="@DATABASE_ID_METHOD@"
-    package="org.apache.torque.test"
-    xmlns="http://db.apache.org/torque/4.0/templates/database"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://db.apache.org/torque/4.0/templates/database 
-        http://db.apache.org/torque/4.0/templates/database.xsd">
+    package="ignored"
+    xmlns="http://db.apache.org/torque/4.0/templates/database">
 
   <include-schema filename="included-schema.xml" />
   <external-schema filename="ext-schema.xml" />
 
-  <!-- TRQS77 -->
-  <table name="course">
-    <column name="id" required="true" primaryKey="true" type="INTEGER" javaType="object" />
-    <column name="col_a" type="CHAR" size="5" />
-  </table>
-
-  <table name="course_number" description="Number for a course">
-    <column name="course_id" required="true" type="INTEGER"/>
-    <column name="course_num" required="true" type="INTEGER"/>
-
-    <foreign-key foreignTable="course"
-     onDelete="cascade" onUpdate="cascade">
-      <reference local="course_id" foreign="id"/>
-    </foreign-key>
-  </table>
-
   <!-- reference to included schema -->
   <table name="reference_to_included">
-    <column
-      name="id"
-      required="true"
-      primaryKey="true"
-      type="INTEGER"
-    />
-    <column
-      name="included_id"
-      required="false"
-      type="INTEGER"
-    />
-    <column
-      name="included_from_included_id"
-      required="false"
-      type="INTEGER"
-    />
+    <column name="id" primaryKey="true" type="INTEGER" />
+    <column name="included_id" type="INTEGER" />
+    <column name="included_from_included_id" type="INTEGER" />
     <foreign-key foreignTable="included">
       <reference local="included_id" foreign="id"/>
     </foreign-key>
@@ -73,7 +42,7 @@
   </table>
 
   <!-- reference to external schema -->
-  <table name="ext_schema">
+  <table name="reference_to_ext_schema">
     <column name="ext_schema_id" required="true" primaryKey="true" type="INTEGER"/>
     <column name="ext_id" type="INTEGER"/>
     <column name="test" required="true" type="INTEGER"/>
@@ -86,7 +55,7 @@
     </foreign-key>
   </table>
 
-  <table name="extext_schema">
+  <table name="reference_to_extext_schema">
     <column name="extext_schema_id" required="true" primaryKey="true" type="INTEGER"/>
     <column name="extext_id" type="INTEGER"/>
     <column name="test" required="true" type="INTEGER"/>
@@ -101,40 +70,6 @@
     <column name="BASE_ID_CODE" primaryKey="true" required="true"
             size="22" type="DECIMAL" javaName="Id"/>
     <column name="BASE_NAME" size="100" type="VARCHAR" javaName="Title"/>
-    <column name="BASE_STATE_CODE" size="2" type="VARCHAR"/>
-    <column name="BASE_ZIP_CODE" size="10" type="VARCHAR"/>
-    <column name="DATA_MODIFIED_ID_CODE" size="22" type="DECIMAL"/>
-    <column name="DATA_MODIFIED_DATE" type="TIMESTAMP"/>
-    <column name="DATA_CREATOR_ID_CODE" size="22" type="DECIMAL"/>
-    <column name="DATA_CREATOR_DATE" type="TIMESTAMP"/>
-    <column name="DATA_TRANSFER_CODE" size="1" type="VARCHAR"/>
-    <column name="BASE_ADDRESS_TEXT" size="2000" type="LONGVARCHAR"/>
-    <column name="BASE_TYPE_TEXT" size="100" type="VARCHAR"/>
-    <column name="START_DATE" type="TIMESTAMP"/>
-    <column name="END_DATE" type="TIMESTAMP"/>
-  </table>
-
-  <!-- test for hypersonic -->
-  <table name="NATIVE_TEST">
-    <column name="NATIVE_ID" required="true" primaryKey="true" type="INTEGER" autoIncrement="true"/>
-    <column name="NAME" type="VARCHAR" size="250"/>
-  </table>
-  <table name="NATIVE_REF_TEST">
-    <column name="NATIVE_ID" required="true" primaryKey="true" type="INTEGER" autoIncrement="true"/>
-    <column name="NAME" type="VARCHAR" size="250"/>
-    <column name="FK_ID" required="true" type="INTEGER"/>
-  </table>
-
-  <!-- TRQS159 Invalid syntaxes for Hypersonic when using indexes. -->
-  <table name="payment_invoice_map"
-         description="maps the many-to-many relationship between payments and invoices">
-    <column name="payment_id" required="false" type="INTEGER"/>
-    <column name="invoice_id" required="false" type="INTEGER"/>
-
-    <index name="ix_uq_payment_invoice_map_pa_in">
-      <index-column name="payment_id"/>
-      <index-column name="invoice_id"/>
-    </index>
   </table>
 
   <!-- test for autoincrement -->
@@ -151,274 +86,26 @@
     <column name="NAME" type="VARCHAR" size="250"/>
   </table>
 
-  <!-- TRQS87  -->
-<!--
-  <table name="reserved_words">
-    <column name="reserved_words_id" required="false" type="INTEGER"/>
-    <column name="class" javaName="JavaClass" required="false" type="VARCHAR"/>
-    <column name="package" javaName="JavaPackage" required="false" type="VARCHAR"/>
-  </table>
--->
-
-  <!-- TRQS97 -->
-  <table name="LEAGUES_OBJECT" description="Contains all leagues">
-    <column name="LEAGUEID" primaryKey="true" required="true" type="TINYINT" javaType="object"/>
-    <column name="LEAGUENAME" required="false" size="100" type="VARCHAR"/>
-    <column name="LEAGUEYEAR" required="false" type="INTEGER" javaType="object"/>
-    <column name="LEAGUESCORETYPE" required="false" type="SMALLINT" default="0" javaType="object"/>
-  </table>
-
-  <table name="LEAGUES_PRIMITIVE" description="Contains all leagues">
-    <column name="LEAGUEID" primaryKey="true" required="true" type="TINYINT" javaType="primitive"/>
-    <column name="LEAGUENAME" required="false" size="100" type="VARCHAR"/>
-    <column name="LEAGUEYEAR" required="false" type="INTEGER" javaType="primitive"/>
-    <column name="LEAGUESCORETYPE" required="false" type="SMALLINT" default="0" javaType="primitive"/>
-  </table>
-
-  <!-- test primary keys which are foreign keys as well -->
-  <table name="multi_pk_foreign_key" idMethod="none">
-    <column name="id" primaryKey="true" required="true" type="INTEGER" />
-    <column name="integer_pk_id" primaryKey="true" required="true" type="INTEGER"/>
-    <column name="name" size="100" type="VARCHAR"/>
-
-    <foreign-key foreignTable="integer_pk">
-      <reference local="integer_pk_id" foreign="id"/>
-    </foreign-key>
-  </table>
-
-  <table name="integer_pk">
-    <column name="id" type="INTEGER" primaryKey="true" required="true"/>
-    <column name="name" size="100" type="VARCHAR"/>
-  </table>
-
-  <table name="integer_object_pk">
-    <column name="id" type="INTEGER" primaryKey="true" required="true" javaType="object"/>
-    <column name="name" size="100" type="VARCHAR"/>
-  </table>
-
   <table name="INHERITANCE_TEST" description="Table to test inheritance with mapped keys">
-    <column
-      name="INHERITANCE_TEST"
-      required="true"
-      primaryKey="true"
-      type="INTEGER"
-    />
-    <column
-      name="CLASS_NAME"
-      inheritance="single"
-      type="CHAR"
-      size="1">
-      <inheritance
-        key="B"
-        class="InheritanceChildB"
-      />
-      <inheritance
-        key="C"
-        class="InheritanceChildC"
-        extends="org.apache.torque.test.dbobject.InheritanceTest"
-      />
-      <inheritance
-        key="D"
-        class="InheritanceChildD"
-        extends="org.apache.torque.test.dbobject.InheritanceChildC"
-      />
+    <column name="INHERITANCE_TEST" primaryKey="true" type="INTEGER" />
+    <column name="CLASS_NAME" inheritance="single" type="CHAR" size="1">
+      <inheritance key="B" class="InheritanceChildB" />
+      <inheritance key="C" class="InheritanceChildC" extends="org.apache.torque.test.dbobject.InheritanceTest" />
+      <inheritance key="D" class="InheritanceChildD" extends="org.apache.torque.test.dbobject.InheritanceChildC" />
     </column>
-    <column
-      name="PAYLOAD_PARENT"
-      required="true"
-      type="VARCHAR"
-      size="100"
-     />
-    <column
-      name="PAYLOAD_B"
-      type="VARCHAR"
-      size="100"
-    />
-    <column
-      name="PAYLOAD_C"
-      type="VARCHAR"
-      size="100"
-    />
-    <column
-      name="PAYLOAD_D"
-      type="VARCHAR"
-      size="100"
-    />
+    <column name="PAYLOAD" required="true" type="VARCHAR" size="100" />
   </table>
 
   <table name="INHERITANCE_CLASSNAME_TEST" description="Table to test inheritance with classnames stored in the inheritance column">
-    <column
-      name="INHERITANCE_TEST"
-      required="true"
-      primaryKey="true"
-      type="INTEGER"
-    />
-    <column
-      name="CLASS_NAME"
-      inheritance="single"
-      type="VARCHAR"
-      size="100"
-    />
-    <column
-      name="PAYLOAD"
-      required="true"
-      type="VARCHAR"
-      size="100"
-     />
+    <column name="INHERITANCE_TEST" primaryKey="true" type="INTEGER" />
+    <column name="CLASS_NAME" inheritance="single" type="VARCHAR" size="100" />
+    <column name="PAYLOAD" required="true" type="VARCHAR" size="100" />
   </table>
 
-
-  <table name="SCALE_TEST" idMethod="none" description="Table to test scale attribute">
-    <column
-      name="SCALE_TEST_ID"
-      required="true"
-      primaryKey="true"
-      type="BIGINT"
-    />
-    <column
-      name="NUMERIC_1"
-      type="NUMERIC"
-      size="10"
-      scale="2"
-      required="false"
-    />
-  </table>
-
-  <table name="CIRCULAR_REFERENCE_A" description="Table to test circular references">
-    <column
-      name="CIRCULAR_REFERENCE_A_ID"
-      required="true"
-      primaryKey="true"
-      type="INTEGER"
-    />
-    <column
-      name="CIRCULAR_REFERENCE_B_ID"
-      type="INTEGER"
-      required="false"
-    />
-    <foreign-key foreignTable="CIRCULAR_REFERENCE_B">
-      <reference 
-        local="CIRCULAR_REFERENCE_B_ID" 
-        foreign="CIRCULAR_REFERENCE_B_ID"/>
-    </foreign-key>
-  </table>
-  
-  <table name="CIRCULAR_REFERENCE_B" description="Table to test circular references">
-    <column
-      name="CIRCULAR_REFERENCE_B_ID"
-      required="true"
-      primaryKey="true"
-      type="INTEGER"
-    />
-    <column
-      name="CIRCULAR_REFERENCE_A_ID"
-      type="INTEGER"
-      required="false"
-    />
-    <foreign-key foreignTable="CIRCULAR_REFERENCE_A">
-      <reference 
-        local="CIRCULAR_REFERENCE_A_ID" 
-        foreign="CIRCULAR_REFERENCE_A_ID"/>
-    </foreign-key>
-  </table>
-
-  <!-- Torque OM generated code did not compile if bean generation is activated and a table references an other table several times -->
-  <table name="referenced" javaName="Referenced" description="Table referenced by several columns of an other table"  idMethod="none">
-    <column name="referenced_pk" javaName="referencedPK" required="true" primaryKey="true" type="VARCHAR" size="12"/>
-    <column name="other_information" javaName="otherInformation" type="VARCHAR" size="255"/>
-  </table>
-
-  <table name="multi_ref_same_table"  description="Table to test multi references to a same table" idMethod="none">
-    <column name="multi_ref_same_table_pk" required="true" primaryKey="true" type="VARCHAR" size="12"/>
-    <column name="an_information" required="true" type="VARCHAR" size="128"/>
-    <column name="reference_1" type="VARCHAR" size="12"/>
-    <column name="reference_2" type="VARCHAR" size="12"/>
-    <column name="reference_3" type="VARCHAR" size="12"/>
-    <foreign-key foreignTable="referenced">
-      <reference local="reference_1" foreign="referenced_pk"/>
-    </foreign-key>
-    <foreign-key foreignTable="referenced">
-      <reference local="reference_2" foreign="referenced_pk"/>
-    </foreign-key>
-    <foreign-key foreignTable="referenced">
-      <reference local="reference_3" foreign="referenced_pk"/>
-    </foreign-key>
-  </table>
-
-<!-- Used by TestOMSetByName but can be used to test all types as needed. 
-     Modified from Generator domaintest-schema.xml -->  
-
-  <table name="types_object" description="used to test the handling for all supported types">
-    <column name="o_bit" type="BIT" javaType="object" />
-    <column name="o_tinyint" type="TINYINT" javaType="object" />
-    <column name="o_smallint" type="SMALLINT" javaType="object" />
-    <column name="o_bigint" type="BIGINT" javaType="object" />
-    <column name="o_float" type="FLOAT" javaType="object" />
-    <column name="o_real" type="REAL" javaType="object" />
-    <column name="o_numeric" type="NUMERIC" javaType="object" />
-    <column name="o_decimal" type="DECIMAL" javaType="object" />
-    <column name="o_char" type="CHAR" javaType="object" />
-    <column name="o_varchar" type="VARCHAR" size="255" javaType="object" />
-    <column name="o_longvarchar" type="LONGVARCHAR" javaType="object" />
-    <column name="o_date" type="DATE" javaType="object" />
-    <column name="o_time" type="TIME"  javaType="object"/>
-    <column name="o_integer" type="INTEGER"  javaType="object"/>
-    <column name="o_timestamp" type="TIMESTAMP"  javaType="object"/>
-    <column name="o_binary" type="BINARY"  javaType="object"/>
-    <column name="o_varbinary" type="VARBINARY"  javaType="object"/>
-    <column name="o_longvarbinary" type="LONGVARBINARY" javaType="object"  />
-    <column name="o_blob" type="BLOB" javaType="object" />
-    <column name="o_clob" type="CLOB" javaType="object" />
-    <column name="o_booleanint" type="BOOLEANINT" javaType="object" />
-    <column name="o_booleanchar" type="BOOLEANCHAR" javaType="object" />
-    <column name="o_double" type="DOUBLE" javaType="object" />
-
-<!--
-Column.getJavaObject() not implimented for these types, so skipping them for now
-
-    <column name="cnull" type="NULL" />
-    <column name="cother" type="OTHER" />
-    <column name="cjavaobject" type="JAVA_OBJECT" />
-    <column name="cdistinct" type="DISTINCT" />
-    <column name="cstruct" type="STRUCT" />
-    <column name="carray" type="ARRAY" />
-    <column name="cref" type="REF" />
--->
-  </table>
-
-<!--  Primitive types in separate table to keep row size from exceeding limits -->
-  <table name="types_primitive" description="used to test the handling for all supported types">
-    <column name="p_bit" type="BIT" javaType="primitive" />
-    <column name="p_tinyint" type="TINYINT" javaType="primitive" />
-    <column name="p_smallint" type="SMALLINT" javaType="primitive" />
-    <column name="p_bigint" type="BIGINT" javaType="primitive" />
-    <column name="p_float" type="FLOAT" javaType="primitive" />
-    <column name="p_real" type="REAL" javaType="primitive" />
-    <column name="p_numeric" type="NUMERIC" javaType="primitive" />
-    <column name="p_decimal" type="DECIMAL" javaType="primitive" />
-    <column name="p_char" type="CHAR" javaType="primitive" />
-    <column name="p_varchar" type="VARCHAR" size="255" javaType="primitive" />
-    <column name="p_longvarchar" type="LONGVARCHAR" javaType="primitive" />
-    <column name="p_date" type="DATE" javaType="primitive" />
-    <column name="p_time" type="TIME"  javaType="primitive"/>
-    <column name="p_integer" type="INTEGER"  javaType="primitive"/>
-    <column name="p_timestamp" type="TIMESTAMP"  javaType="primitive"/>
-    <column name="p_binary" type="BINARY"  javaType="primitive"/>
-    <column name="p_varbinary" type="VARBINARY"  javaType="primitive"/>
-    <column name="p_longvarbinary" type="LONGVARBINARY" javaType="primitive"  />
-    <column name="p_blob" type="BLOB" javaType="primitive" />
-    <column name="p_clob" type="CLOB" javaType="primitive" />
-    <column name="p_booleanint" type="BOOLEANINT" javaType="primitive" />
-    <column name="p_booleanchar" type="BOOLEANCHAR" javaType="primitive" />
-    <column name="p_double" type="DOUBLE" javaType="primitive" />
-  </table>
-  
-  <!--  Table to test SummaryHelper class  -->
-  <table name="SUMMARIZE1" description="Test table for summaryHelper class" >
-    <column name="ID" required="true" primaryKey="true" type="INTEGER" 
-            description="id column" autoIncrement="true" />
-    <column name="GROUP_BY1" type="VARCHAR" javaType="primitive" size="100" />
-    <column name="GROUP_BY2" type="VARCHAR" javaType="primitive" size="100" />
+  <table name="SUMMARIZE1" description="Test table for summaryHelper test" >
+    <column name="ID" primaryKey="true" type="INTEGER" description="id column"/>
+    <column name="GROUP_BY1" type="VARCHAR" size="100" />
+    <column name="GROUP_BY2" type="VARCHAR" size="100" />
     <column name="INT_1" type="INTEGER" javaType="primitive" />
     <column name="FLOAT1" type="FLOAT" javaType="primitive" />
     <column name="TYPE" type="INTEGER" javaType="primitive" />
@@ -426,15 +113,24 @@ Column.getJavaObject() not implimented f
   
   <table name="SKIP_SQL" skipSql="true" description="table without SQL">
     <column name="ID" primaryKey="true" type="INTEGER" description="id for table without SQL"/>
-    <column name="FK" required="true" type="INTEGER" size="30" />
-    <foreign-key foreignTable="integer_pk">
-      <reference 
-        local="FK" 
-        foreign="id"/>
-    </foreign-key>
+    <column name="NAME" type="VARCHAR" size="30" />
   </table>
 
   <table name="ABSTRACT" abstract="true" description="table with abstract OM class">
     <column name="ID" primaryKey="true" type="INTEGER"  description="id for table with abstract OM class"/>
   </table>
+
+  <table name="ifc_table" idMethod="none"
+    interface="org.apache.torque.TestInterface"
+    description="this table implements an interface">
+    <column name="id" javaName="ID" primaryKey="true" type="INTEGER" />
+    <column name="name" javaName="Name" type="VARCHAR" size="50" />
+  </table>
+
+  <table name="local_ifc_table" idMethod="none"
+      interface="LocalTestInterface"
+      description="this table implements a local interface">
+    <column name="id" javaName="ID" primaryKey="true" type="INTEGER" />
+    <column name="name" javaName="Name" type="VARCHAR" size="50" />
+  </table>
 </database>

Modified: db/torque/torque4/trunk/torque-test/src/main/schema/types-schema.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/types-schema.xml?rev=1436782&r1=1436781&r2=1436782&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/main/schema/types-schema.xml (original)
+++ db/torque/torque4/trunk/torque-test/src/main/schema/types-schema.xml Tue Jan 22 07:51:31 2013
@@ -26,51 +26,198 @@
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://db.apache.org/torque/4.0/templates/database 
         http://db.apache.org/torque/4.0/templates/database.xsd">
-  <table name="bit_value" idMethod="none">
-    <column name="id" required="true" primaryKey="true" type="VARCHAR" size="10" />
-    <column name="bit_value" required="true" type="BIT" />
-  </table>
-
-  <table name="blob_test">
-    <column name="id" required="true" primaryKey="true" type="BIGINT" />
-    <column name="blob_value" type="BLOB" required="false"/>
-  </table>
-
-  <table name="clob_test">
-    <column name="id" required="true" primaryKey="true" type="INTEGER" />
-    <column name="clob_value" type="CLOB" required="false"/>
-  </table>
-  
-  <table name="bint_bchar_value" idMethod="none">
-    <column name="id" required="true" primaryKey="true" type="VARCHAR" size="20" />
-    <column name="bint_value" required="true" type="BOOLEANINT" />
-    <column name="bchar_value" required="true" type="BOOLEANCHAR" />
-    <column name="bint_object_value" type="BOOLEANINT" javaType="object"/>
-    <column name="bchar_object_value" type="BOOLEANCHAR" javaType="object"/>
-  </table>
-
-  <table name="DATE_TIME_TIMESTAMP" description="Table to test Date formats">
-    <column
-      name="ID"
-      required="true"
-      primaryKey="true"
-      type="INTEGER"
-    />
-    <column
-      name="DATE_VALUE"
-      required="true"
-      type="DATE"
-    />
-    <column
-      name="TIME_VALUE"
-      required="true"
-      type="TIME"
-    />
-    <column
-      name="TIMESTAMP_VALUE"
-      required="true"
-      type="TIMESTAMP"
-    />
+
+<!-- Used by TestOMSetByName but can be used to test all types as needed. 
+     Modified from Generator domaintest-schema.xml -->  
+
+  <table name="types_object" description="used to test the handling for all supported types">
+    <column name="id" type="INTEGER" javaType="object" primaryKey="true"/>
+    <column name="o_bit" type="BIT" javaType="object" />
+    <column name="o_tinyint" type="TINYINT" javaType="object" />
+    <column name="o_smallint" type="SMALLINT" javaType="object" />
+    <column name="o_bigint" type="BIGINT" javaType="object" />
+    <column name="o_float" type="FLOAT" javaType="object" />
+    <column name="o_real" type="REAL" javaType="object" />
+    <column name="o_numeric" type="NUMERIC" javaType="object" />
+    <column name="o_decimal" type="DECIMAL" javaType="object" />
+    <column name="o_char" type="CHAR" javaType="object" />
+    <column name="o_varchar" type="VARCHAR" size="255" javaType="object" />
+    <column name="o_longvarchar" type="LONGVARCHAR" javaType="object" />
+    <column name="o_date" type="DATE" javaType="object" />
+    <column name="o_time" type="TIME"  javaType="object"/>
+    <column name="o_integer" type="INTEGER"  javaType="object"/>
+    <column name="o_timestamp" type="TIMESTAMP"  javaType="object"/>
+    <column name="o_binary" type="BINARY" javaType="object"/>
+    <column name="o_varbinary" type="VARBINARY" size="255"  javaType="object"/>
+    <column name="o_longvarbinary" type="LONGVARBINARY" javaType="object"  />
+    <column name="o_blob" type="BLOB" javaType="object" />
+    <column name="o_clob" type="CLOB" javaType="object" />
+    <column name="o_booleanint" type="BOOLEANINT" javaType="object" />
+    <column name="o_booleanchar" type="BOOLEANCHAR" javaType="object" />
+    <column name="o_double" type="DOUBLE" javaType="object" />
+
+<!--
+Column.getJavaObject() not implimented for these types, so skipping them for now
+
+    <column name="cnull" type="NULL" />
+    <column name="cother" type="OTHER" />
+    <column name="cjavaobject" type="JAVA_OBJECT" />
+    <column name="cdistinct" type="DISTINCT" />
+    <column name="cstruct" type="STRUCT" />
+    <column name="carray" type="ARRAY" />
+    <column name="cref" type="REF" />
+-->
+  </table>
+
+<!--  Primitive types in separate table to keep row size from exceeding limits -->
+  <table name="types_primitive" description="used to test the handling for all supported types">
+    <column name="id" type="INTEGER" javaType="primitive" primaryKey="true"/>
+    <column name="p_bit" type="BIT" javaType="primitive" />
+    <column name="p_tinyint" type="TINYINT" javaType="primitive" />
+    <column name="p_smallint" type="SMALLINT" javaType="primitive" />
+    <column name="p_bigint" type="BIGINT" javaType="primitive" />
+    <column name="p_float" type="FLOAT" javaType="primitive" />
+    <column name="p_real" type="REAL" javaType="primitive" />
+    <column name="p_numeric" type="NUMERIC" javaType="primitive" />
+    <column name="p_decimal" type="DECIMAL" javaType="primitive" />
+    <column name="p_char" type="CHAR" javaType="primitive" />
+    <column name="p_varchar" type="VARCHAR" size="255" javaType="primitive" />
+    <column name="p_longvarchar" type="LONGVARCHAR" javaType="primitive" />
+    <column name="p_date" type="DATE" javaType="primitive" />
+    <column name="p_time" type="TIME"  javaType="primitive"/>
+    <column name="p_integer" type="INTEGER"  javaType="primitive"/>
+    <column name="p_timestamp" type="TIMESTAMP"  javaType="primitive"/>
+    <column name="p_binary" type="BINARY" javaType="primitive"/>
+    <column name="p_varbinary" type="VARBINARY" size="255" javaType="primitive"/>
+    <column name="p_longvarbinary" type="LONGVARBINARY" javaType="primitive"  />
+    <column name="p_blob" type="BLOB" javaType="primitive" />
+    <column name="p_clob" type="CLOB" javaType="primitive" />
+    <column name="p_booleanint" type="BOOLEANINT" javaType="primitive" />
+    <column name="p_booleanchar" type="BOOLEANCHAR" javaType="primitive" />
+    <column name="p_double" type="DOUBLE" javaType="primitive" />
+  </table>
+
+  <table name="BIT_TYPE" idMethod="none">
+    <column name="ID" primaryKey="true" type="VARCHAR" size="10"/>
+    <column name="BIT_VALUE" type="BIT" />
+    <column name="BIT_OBJECT_VALUE" type="BIT" javaType="object"/>
+  </table>
+
+  <table name="BLOB_TYPE">
+    <column name="ID" primaryKey="true" type="BIGINT"/>
+    <column name="BLOB_VALUE" type="BLOB"/>
+    <column name="BLOB_OBJECT_VALUE" type="BLOB" javaType="object"/>
+  </table>
+
+  <table name="CLOB_TYPE">
+    <column name="ID" primaryKey="true" type="INTEGER"/>
+    <column name="CLOB_VALUE" type="CLOB"/>
+    <column name="CLOB_OBJECT_VALUE" type="CLOB" javaType="object"/>
+  </table>
+  
+  <!-- table name="BINARY_TYPE" description="Table to test BINARY type">
+    <column name="ID" primaryKey="true" type="INTEGER"/>
+    <column name="BINARY_VALUE" type="BINARY"/>
+    <column name="BINARY_OBJECT_VALUE" type="BINARY" javaType="object"/>
+  </table>
+  
+  <table name="VARBINARY_TYPE" description="Table to test VARBINARY type">
+    <column name="ID" primaryKey="true" type="INTEGER"/>
+    <column name="VARBINARY_VALUE" type="VARBINARY"/>
+    <column name="VARBINARY_OBJECT_VALUE" type="VARBINARY" javaType="object"/>
+  </table>
+  
+  <table name="LONGVARBINARY_TYPE" description="Table to test LONGVARBINARY type">
+    <column name="ID" primaryKey="true" type="INTEGER"/>
+    <column name="LONGVARBINARY_VALUE" type="LONGVARBINARY"/>
+    <column name="LONGVARBINARY_OBJECT_VALUE" type="LONGVARBINARY" javaType="object"/>
+  </table-->
+  
+  <table name="BINT_BCHAR_TYPE" idMethod="none">
+    <column name="ID" required="true" primaryKey="true" type="VARCHAR" size="20"/>
+    <column name="BINT_VALUE" required="true" type="BOOLEANINT"/>
+    <column name="BCHAR_VALUE" required="true" type="BOOLEANCHAR"/>
+    <column name="BINT_OBJECT_VALUE" type="BOOLEANINT" javaType="object"/>
+    <column name="BCHAR_OBJECT_VALUE" type="BOOLEANCHAR" javaType="object"/>
+  </table>
+
+  <table name="DATE_TIME_TIMESTAMP_TYPE" description="Table to test Date formats">
+    <column name="ID" primaryKey="true" type="INTEGER"/>
+    <column name="DATE_VALUE" required="true" type="DATE"/>
+    <column name="TIME_VALUE" required="true" type="TIME"/>
+    <column name="TIMESTAMP_VALUE" required="true" type="TIMESTAMP"/>
   </table>
 
+  <!-- table name="TINYINT_TYPE" description="Table to test TINYINT type">
+    <column name="ID" primaryKey="true" type="TINYINT"/>
+    <column name="TINYINT_VALUE" type="TINYINT"/>
+    <column name="TINYINT_OBJECT_VALUE" type="TINYINT" javaType="object"/>
+  </table>
+  
+  <table name="SMALLINT_TYPE" description="Table to test SMALLINT type">
+    <column name="ID" primaryKey="true" type="SMALLINT"/>
+    <column name="SMALLINT_VALUE" type="SMALLINT"/>
+    <column name="SMALLINT_OBJECT_VALUE" type="SMALLINT" javaType="object"/>
+  </table-->
+  
+  <table name="INTEGER_TYPE" description="Table to test INTEGER type">
+    <column name="ID" primaryKey="true" type="INTEGER"/>
+    <column name="INTEGER_VALUE" type="INTEGER"/>
+    <column name="INTEGER_OBJECT_VALUE" type="INTEGER" javaType="object"/>
+  </table>
+  
+  <table name="BIGINT_TYPE" description="Table to test BIGINT type">
+    <column name="ID" primaryKey="true" type="BIGINT"/>
+    <column name="BIGINT_VALUE" type="BIGINT"/>
+    <column name="BIGINT_OBJECT_VALUE" type="BIGINT" javaType="object"/>
+  </table>
+  
+  <!-- table name="FLOAT_TYPE" description="Table to test FLOAT type">
+    <column name="ID" primaryKey="true" type="FLOAT"/>
+    <column name="FLOAT_VALUE" type="FLOAT"/>
+    <column name="FLOAT_OBJECT_VALUE" type="FLOAT" javaType="object"/>
+  </table>
+  
+  <table name="REAL_TYPE" description="Table to test REAL type">
+    <column name="ID" primaryKey="true" type="REAL"/>
+    <column name="REAL_VALUE" type="REAL"/>
+    <column name="REAL_OBJECT_VALUE" type="REAL" javaType="object"/>
+  </table>
+  
+  <table name="DOUBLE_TYPE" description="Table to test DOUBLE type">
+    <column name="ID" primaryKey="true" type="DOUBLE"/>
+    <column name="DOUBLE_VALUE" type="DOUBLE"/>
+    <column name="DOUBLE_OBJECT_VALUE" type="DOUBLE" javaType="object"/>
+  </table>
+  
+  <table name="DECIMAL_TYPE" description="Table to test DECIMAL type">
+    <column name="ID" primaryKey="true" type="DECIMAL"/>
+    <column name="DECIMAL_VALUE" type="DECIMAL"/>
+    <column name="DECIMAL_OBJECT_VALUE" type="DECIMAL" javaType="object"/>
+  </table>
+  
+  <table name="NUMERIC_TYPE" description="Table to test NUMERIC type">
+    <column name="ID" primaryKey="true" type="NUMERIC"/>
+    <column name="NUMERIC_VALUE" type="NUMERIC" size="10" scale="2"/>
+    <column name="NUMERIC_OBJECT_VALUE" type="NUMERIC" javaType="object"/>
+  </table>
+  
+  <table name="CHAR_TYPE" idMethod="none" description="Table to test CHAR type">
+    <column name="ID" primaryKey="true" type="CHAR" size="5"/>
+    <column name="CHAR_VALUE" type="CHAR" size="10"/>
+    <column name="CHAR_OBJECT_VALUE" type="CHAR" javaType="object" size="20"/>
+  </table-->
+  
+  <table name="VARCHAR_TYPE" idMethod="none" description="Table to test VARCHAR type">
+    <column name="ID" primaryKey="true" type="VARCHAR" size="20"/>
+    <column name="VARCHAR_VALUE" type="VARCHAR" size="20"/>
+    <column name="VARCHAR_OBJECT_VALUE" type="VARCHAR" javaType="object" size="20"/>
+  </table>
+  
+  <!-- table name="LONGVARCHAR_TYPE" idMethod="none" description="Table to test LONGVARCHAR type">
+    <column name="ID" primaryKey="true" type="LONGVARCHAR" size="20"/>
+    <column name="LONGVARCHAR_VALUE" type="LONGVARCHAR" size="20"/>
+    <column name="LONGVARCHAR_OBJECT_VALUE" type="LONGVARCHAR" javaType="object" size="20"/>
+  </table-->
+  
 </database>

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java?rev=1436782&r1=1436781&r2=1436782&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java Tue Jan 22 07:51:31 2013
@@ -43,37 +43,38 @@ import org.apache.torque.om.mapper.Recor
 import org.apache.torque.test.InheritanceClassnameTestChild1;
 import org.apache.torque.test.InheritanceClassnameTestChild2;
 import org.apache.torque.test.dbobject.Author;
-import org.apache.torque.test.dbobject.BlobTest;
+import org.apache.torque.test.dbobject.BigintType;
+import org.apache.torque.test.dbobject.BlobType;
 import org.apache.torque.test.dbobject.Book;
-import org.apache.torque.test.dbobject.ClobTest;
+import org.apache.torque.test.dbobject.ClobType;
+import org.apache.torque.test.dbobject.CompPkContainsFk;
 import org.apache.torque.test.dbobject.IfcTable;
-import org.apache.torque.test.dbobject.IfcTable2;
 import org.apache.torque.test.dbobject.InheritanceChildB;
 import org.apache.torque.test.dbobject.InheritanceChildC;
 import org.apache.torque.test.dbobject.InheritanceChildD;
 import org.apache.torque.test.dbobject.InheritanceClassnameTest;
 import org.apache.torque.test.dbobject.InheritanceTest;
-import org.apache.torque.test.dbobject.IntegerPk;
-import org.apache.torque.test.dbobject.LargePk;
+import org.apache.torque.test.dbobject.IntegerType;
+import org.apache.torque.test.dbobject.LocalIfcTable;
 import org.apache.torque.test.dbobject.LocalTestInterface;
 import org.apache.torque.test.dbobject.MultiPk;
-import org.apache.torque.test.dbobject.MultiPkForeignKey;
 import org.apache.torque.test.dbobject.Nopk;
-import org.apache.torque.test.dbobject.NullValueTable;
+import org.apache.torque.test.dbobject.OIntegerPk;
+import org.apache.torque.test.dbobject.VarcharType;
 import org.apache.torque.test.peer.AuthorPeer;
-import org.apache.torque.test.peer.BlobTestPeer;
+import org.apache.torque.test.peer.BigintTypePeer;
+import org.apache.torque.test.peer.BlobTypePeer;
 import org.apache.torque.test.peer.BookPeer;
-import org.apache.torque.test.peer.ClobTestPeer;
-import org.apache.torque.test.peer.IfcTable2Peer;
+import org.apache.torque.test.peer.ClobTypePeer;
+import org.apache.torque.test.peer.CompPkContainsFkPeer;
 import org.apache.torque.test.peer.IfcTablePeer;
 import org.apache.torque.test.peer.InheritanceClassnameTestPeer;
 import org.apache.torque.test.peer.InheritanceTestPeer;
-import org.apache.torque.test.peer.IntegerPkPeer;
-import org.apache.torque.test.peer.LargePkPeer;
-import org.apache.torque.test.peer.MultiPkForeignKeyPeer;
+import org.apache.torque.test.peer.IntegerTypePeer;
+import org.apache.torque.test.peer.LocalIfcTablePeer;
 import org.apache.torque.test.peer.MultiPkPeer;
 import org.apache.torque.test.peer.NopkPeer;
-import org.apache.torque.test.peer.NullValueTablePeer;
+import org.apache.torque.test.peer.VarcharTypePeer;
 import org.apache.torque.test.recordmapper.AuthorRecordMapper;
 import org.apache.torque.test.recordmapper.BookRecordMapper;
 import org.apache.torque.util.BasePeer;
@@ -260,81 +261,51 @@ public class DataTest extends BaseDataba
     public void testNullSelects() throws Exception
     {
         // clean table
-        Criteria criteria = new Criteria();
-        criteria.where(
-                NullValueTablePeer.NULL_VALUE_TABLE_ID,
-                -1,
-                Criteria.NOT_EQUAL);
-        NullValueTablePeer.doDelete(criteria);
+        VarcharTypePeer.doDelete(new Criteria());
+        IntegerTypePeer.doDelete(new Criteria());
 
         // add test data
-        NullValueTable nvt = new NullValueTable();
-        nvt.setText1("text");
-        nvt.setNumberObj1(new Integer(1));
-        nvt.save();
-        nvt = new NullValueTable();
-        nvt.setText2("text");
-        nvt.save();
+        VarcharType varcharType = new VarcharType();
+        varcharType.setId("text2");
+        varcharType.setVarcharValue("text2");
+        varcharType.save();
+        varcharType = new VarcharType();
+        varcharType.setId("text");
+        varcharType.save();
+
+        IntegerType integerTypeNotNull = new IntegerType();
+        integerTypeNotNull.setIntegerObjectValue(1);
+        integerTypeNotNull.save();
+        IntegerType integerTypeNull = new IntegerType();
+        integerTypeNull.save();
 
-        // do check for comparison NOT_EQUAL and value null
-        criteria = new Criteria();
-        criteria.where(
-                NullValueTablePeer.TEXT1,
-                (Integer)null,
-                Criteria.NOT_EQUAL);
-        criteria.and(NullValueTablePeer.NUMBER_OBJ1,
-                (Integer)null,
-                Criteria.NOT_EQUAL);
-        List<NullValueTable> result = NullValueTablePeer.doSelect(criteria);
-        assertEquals("testNullSelects()"
-                + "Result size should be 1 but is "
-                + result.size(),
-                1,
-                result.size());
-        nvt = result.get(0);
-        assertEquals("testNullSelects()"
-                + "Text1 should be \"text\" but is"
-                + nvt.getText1(),
-                nvt.getText1(),
-                "text");
-
-        // do check for comparison EQUAL and value null
-        criteria = new Criteria();
-        criteria.where(
-                NullValueTablePeer.TEXT1,
-                (Integer)null,
-                Criteria.EQUAL);
-        criteria.and(NullValueTablePeer.NUMBER_OBJ1,
-                (Integer)null,
-                Criteria.EQUAL);
-        result = NullValueTablePeer.doSelect(criteria);
-        assertEquals("testNullSelects()"
-                + "Result size should be 1 but is "
-                + result.size(),
-                1,
-                result.size());
-        nvt = result.get(0);
-        assertEquals("testNullSelects()"
-                + "Text2 should be \"text\" but is"
-                + nvt.getText2(),
-                nvt.getText2(),
-                "text");
-    }
-
-    /**
-     * tests whether null values can be processed successfully by datadump
-     * For this, a row containing null values is inserted here,
-     * the actual test is done later
-     * @throws Exception if inserting the test data fails
-     */
-    public void testDataDump() throws Exception
-    {
-        NullValueTable nvt = new NullValueTable();
-        nvt.setNumber1(1);
-        nvt.setNumber3(3);
-        nvt.setText1("text");
-        nvt.setNumberObj1(new Integer(1));
-        nvt.save();
+        // check for comparison NOT_EQUAL and value null
+        Criteria criteria = new Criteria();
+        criteria.where(VarcharTypePeer.ID, null, Criteria.NOT_EQUAL)
+            .and(VarcharTypePeer.VARCHAR_VALUE, null, Criteria.NOT_EQUAL);
+        List<VarcharType> varcharResult = VarcharTypePeer.doSelect(criteria);
+        assertEquals(1, varcharResult.size());
+        assertEquals("text2", varcharResult.get(0).getId());
+
+        criteria = new Criteria();
+        criteria.where(IntegerTypePeer.ID, null, Criteria.NOT_EQUAL)
+            .and(IntegerTypePeer.INTEGER_OBJECT_VALUE, null, Criteria.NOT_EQUAL);
+        List<IntegerType> integerResult = IntegerTypePeer.doSelect(criteria);
+        assertEquals(1, integerResult.size());
+        assertEquals(integerTypeNotNull.getId(), integerResult.get(0).getId());
+
+        // check for comparison EQUAL and value null
+        criteria = new Criteria();
+        criteria.where(VarcharTypePeer.VARCHAR_VALUE, null, Criteria.EQUAL);
+        varcharResult = VarcharTypePeer.doSelect(criteria);
+        assertEquals(1, varcharResult.size());
+        assertEquals("text", varcharResult.get(0).getId());
+
+        criteria = new Criteria();
+        criteria.where(IntegerTypePeer.INTEGER_OBJECT_VALUE, null, Criteria.EQUAL);
+        integerResult = IntegerTypePeer.doSelect(criteria);
+        assertEquals(1, integerResult.size());
+        assertEquals(integerTypeNull.getId(), integerResult.get(0).getId());
     }
 
     /**
@@ -924,29 +895,17 @@ public class DataTest extends BaseDataba
      */
     public void testLargePk() throws Exception
     {
-        // clean LargePk table
-        Criteria criteria = new Criteria();
-        criteria.where(
-                LargePkPeer.ID,
-                (Long) null,
-                Criteria.NOT_EQUAL);
-        LargePkPeer.doDelete(criteria);
+        BigintTypePeer.doDelete(new Criteria());
 
         long longId = 8771507845873286l;
-        LargePk largePk = new LargePk();
-        largePk.setId(longId);
-        largePk.setName("testLargePk");
-        largePk.save();
-
-        List<LargePk> largePkList = LargePkPeer.doSelect(new Criteria());
-        LargePk readLargePk = largePkList.get(0);
-        assertTrue("the inserted Id, " + largePk.getId()
-                + " , and the read id, " + readLargePk.getId()
-                + " , should be equal",
-                readLargePk.getId() == largePk.getId());
-        assertTrue("the inserted Id, " + largePk.getId()
-                + " , should be equal to " + longId,
-                longId == largePk.getId());
+        BigintType bigintType = new BigintType();
+        bigintType.setId(longId);
+        bigintType.save();
+
+        List<BigintType> bigintTypeList = BigintTypePeer.doSelect(new Criteria());
+        BigintType readBigintType = bigintTypeList.get(0);
+        assertEquals(bigintType.getId(), readBigintType.getId());
+        assertEquals(longId, readBigintType.getId());
     }
 
     /**
@@ -1004,21 +963,21 @@ public class DataTest extends BaseDataba
      */
     public void testMultiplePrimaryForeignKey() throws Exception
     {
-        // clean IntegerPk and MultiPkForeignKey table
-        Criteria criteria = new Criteria();
-        criteria.where(MultiPkForeignKeyPeer.ID, (Integer) null, Criteria.NOT_EQUAL);
-        MultiPkForeignKeyPeer.doDelete(criteria);
-        criteria = new Criteria();
-        criteria.where(IntegerPkPeer.ID, (Integer) null, Criteria.NOT_EQUAL);
-        IntegerPkPeer.doDelete(criteria);
+        ForeignKeySchemaData.clearTablesInDatabase();
 
-        IntegerPk integerPk = new IntegerPk();
-        integerPk.save();
-        MultiPkForeignKey multiPkForeignKey = new MultiPkForeignKey();
-        multiPkForeignKey.setId(10);
-        multiPkForeignKey.setIntegerPk(integerPk);
-        multiPkForeignKey.save();
-        integerPk.save();
+        OIntegerPk oIntegerPk = new OIntegerPk();
+        oIntegerPk.save();
+        CompPkContainsFk compPkContainsFk = new CompPkContainsFk();
+        compPkContainsFk.setId1(oIntegerPk.getId());
+        compPkContainsFk.setId2("test");
+        compPkContainsFk.save();
+
+        List<CompPkContainsFk> selectedList
+                = CompPkContainsFkPeer.doSelect(new Criteria());
+        assertEquals(1, selectedList.size());
+        CompPkContainsFk selected = selectedList.get(0);
+        assertEquals(oIntegerPk.getId(), selected.getId1());
+        assertEquals("test", selected.getId2());
     }
 
     /**
@@ -1044,19 +1003,11 @@ public class DataTest extends BaseDataba
      */
     public void testBlobs() throws Exception
     {
-        // clean BlobTest table
-        {
-            Criteria criteria = new Criteria();
-            criteria.where(
-                    BlobTestPeer.ID,
-                    (Long) null,
-                    Criteria.NOT_EQUAL);
-            BlobTestPeer.doDelete(criteria);
-        }
+        BlobTypePeer.doDelete(new Criteria());
 
-        // create a new BlobTest Object with large blob and clob values
+        // create a new BlobType Object with large blob values
         // and save it
-        BlobTest blobTest = new BlobTest();
+        BlobType blobType = new BlobType();
         {
             int length = 100000;
             byte[] bytes = new byte[length];
@@ -1064,29 +1015,27 @@ public class DataTest extends BaseDataba
             {
                 bytes[i] = new Integer(i % 256).byteValue();
             }
-            blobTest.setBlobValue(bytes);
+            blobType.setBlobValue(bytes);
         }
-        blobTest.save();
+        blobType.save();
 
-        // read the BlobTests from the database
+        // read the BlobTypes from the database
         // and check the values against the original values
-        List<BlobTest> blobTestList = BlobTestPeer.doSelect(new Criteria());
-        assertTrue("blobTestList should contain 1 object but contains "
-                + blobTestList.size(),
-                blobTestList.size() == 1);
+        List<BlobType> blobTypeList = BlobTypePeer.doSelect(new Criteria());
+        assertEquals(1, blobTypeList.size());
 
-        BlobTest readBlobTest = blobTestList.get(0);
+        BlobType readBlobType = blobTypeList.get(0);
         assertTrue("read and written blobs should be equal. "
                 + "Size of read blob is"
-                + readBlobTest.getBlobValue().length
+                + readBlobType.getBlobValue().length
                 + " size of written blob is "
-                + blobTest.getBlobValue().length,
+                + blobType.getBlobValue().length,
                 Arrays.equals(
-                        blobTest.getBlobValue(),
-                        readBlobTest.getBlobValue()));
+                        blobType.getBlobValue(),
+                        readBlobType.getBlobValue()));
 
         // test updating
-        blobTest = readBlobTest;
+        blobType = readBlobType;
         {
             int length = 200000;
             byte[] bytes = new byte[length];
@@ -1097,26 +1046,24 @@ public class DataTest extends BaseDataba
                 bytes[i] = new Integer(i % 256).byteValue();
                 chars.append(charTemplate.charAt(i % charTemplate.length()));
             }
-            blobTest.setBlobValue(bytes);
+            blobType.setBlobValue(bytes);
         }
-        blobTest.save();
+        blobType.save();
 
-        // read the BlobTests from the database
+        // read the BlobTypes from the database
         // and check the values against the updated values
-        blobTestList = BlobTestPeer.doSelect(new Criteria());
-        assertTrue("blobTestList should contain 1 object but contains "
-                + blobTestList.size(),
-                blobTestList.size() == 1);
+        blobTypeList = BlobTypePeer.doSelect(new Criteria());
+        assertEquals(1, blobTypeList.size());
 
-        readBlobTest = blobTestList.get(0);
+        readBlobType = blobTypeList.get(0);
         assertTrue("read and written blobs should be equal. "
                 + "Size of read blob is"
-                + readBlobTest.getBlobValue().length
+                + readBlobType.getBlobValue().length
                 + " size of written blob is "
-                + blobTest.getBlobValue().length,
+                + blobType.getBlobValue().length,
                 Arrays.equals(
-                        blobTest.getBlobValue(),
-                        readBlobTest.getBlobValue()));
+                        blobType.getBlobValue(),
+                        readBlobType.getBlobValue()));
     }
 
 
@@ -1126,67 +1073,53 @@ public class DataTest extends BaseDataba
      */
     public void testClobs() throws Exception
     {
-        // clean ClobTest table
-        {
-            Criteria criteria = new Criteria();
-            criteria.where(
-                    ClobTestPeer.ID,
-                    (Long) null,
-                    Criteria.NOT_EQUAL);
-            ClobTestPeer.doDelete(criteria);
-        }
+        ClobTypePeer.doDelete(new Criteria());
 
-        // create a new ClobTest Object with a large clob value
+        // create a new ClobType Object with a large clob value
         // and save it
-        ClobTest clobTest = new ClobTest();
+        ClobType clobType = new ClobType();
         {
-            int length = 10000;
+            int length = 40000;
             StringBuffer chars = new StringBuffer();
             String charTemplate = "1234567890abcdefghijklmnopqrstuvwxyz";
             for (int i = 0; i < length; ++i)
             {
                  chars.append(charTemplate.charAt(i % charTemplate.length()));
             }
-            clobTest.setClobValue(chars.toString());
+            clobType.setClobValue(chars.toString());
         }
-        clobTest.save();
+        clobType.save();
 
-        // read the ClobTests from the database
+        // read the ClobTypes from the database
         // and check the values against the original values
-        List<ClobTest> clobTestList = ClobTestPeer.doSelect(new Criteria());
-        assertTrue("clobTestList should contain 1 object but contains "
-                + clobTestList.size(),
-                clobTestList.size() == 1);
-
-        ClobTest readClobTest = clobTestList.get(0);
-        assertTrue("read and written clobs should be equal",
-                clobTest.getClobValue().equals(readClobTest.getClobValue()));
+        List<ClobType> clobTypeList = ClobTypePeer.doSelect(new Criteria());
+        assertEquals(1, clobTypeList.size());
+
+        ClobType readClobType = clobTypeList.get(0);
+        assertEquals(clobType.getClobValue(), readClobType.getClobValue());
 
 
         // Test updating
-        clobTest = readClobTest;
+        clobType = readClobType;
         {
-            int length = 20000;
+            int length = 50000;
             StringBuffer chars = new StringBuffer();
             String charTemplate = "0987654321abcdefghijklmnopqrstuvwxyz";
             for (int i = 0; i < length; ++i)
             {
                  chars.append(charTemplate.charAt(i % charTemplate.length()));
             }
-            clobTest.setClobValue(chars.toString());
+            clobType.setClobValue(chars.toString());
         }
-        clobTest.save();
+        clobType.save();
 
-        // read the ClobTests from the database
+        // read the ClobTypes from the database
         // and check the values against the original values
-        clobTestList = ClobTestPeer.doSelect(new Criteria());
-        assertTrue("clobTestList should contain 1 object but contains "
-                + clobTestList.size(),
-                clobTestList.size() == 1);
-
-        readClobTest = clobTestList.get(0);
-        assertTrue("read and written clobs should be equal",
-                clobTest.getClobValue().equals(readClobTest.getClobValue()));
+        clobTypeList = ClobTypePeer.doSelect(new Criteria());
+        assertEquals(1, clobTypeList.size());
+
+        readClobType = clobTypeList.get(0);
+        assertEquals(clobType.getClobValue(), readClobType.getClobValue());
     }
 
     /**
@@ -1246,18 +1179,18 @@ public class DataTest extends BaseDataba
                 ifcTable instanceof TestInterface);
         }
 
-        IfcTable2 ifc2 = new IfcTable2();
+        LocalIfcTable localIfc = new LocalIfcTable();
 
-        assertTrue("IfcTable2 should be an instance of LocalTestInterface",
-                ifc2 instanceof LocalTestInterface);
+        assertTrue("LocalIfcTable should be an instance of LocalTestInterface",
+                localIfc instanceof LocalTestInterface);
 
-        List<IfcTable2> results2 = IfcTable2Peer.doSelect(new Criteria());
+        List<LocalIfcTable> results2 = LocalIfcTablePeer.doSelect(new Criteria());
 
-        for (IfcTable2 ifcTable2 : results2)
+        for (LocalIfcTable readLocalIfcTable : results2)
         {
             assertTrue("IfcTable2Peer.doSelect should return"
                     + " instances of LocalTestInterface",
-                ifcTable2 instanceof LocalTestInterface);
+                    readLocalIfcTable instanceof LocalTestInterface);
         }
     }
 
@@ -1280,16 +1213,16 @@ public class DataTest extends BaseDataba
 
         // create & save test data
         InheritanceTest inheritanceTest = new InheritanceTest();
-        inheritanceTest.setPayloadParent("payload Parent 1");
+        inheritanceTest.setPayload("payload1");
         inheritanceTest.save();
         InheritanceChildB inheritanceChildB = new InheritanceChildB();
-        inheritanceChildB.setPayloadParent("payload Parent 2");
+        inheritanceChildB.setPayload("payload 2");
         inheritanceChildB.save();
         InheritanceChildC inheritanceChildC = new InheritanceChildC();
-        inheritanceChildC.setPayloadParent("payload Parent 3");
+        inheritanceChildC.setPayload("payload 3");
         inheritanceChildC.save();
         InheritanceChildD inheritanceChildD = new InheritanceChildD();
-        inheritanceChildD.setPayloadParent("payload Parent 4");
+        inheritanceChildD.setPayload("payload 4");
         inheritanceChildD.save();
 
         // Check that all objects are saved into the InheritanceTest table

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ForeignKeySchemaData.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ForeignKeySchemaData.java?rev=1436782&r1=1436781&r2=1436782&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ForeignKeySchemaData.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ForeignKeySchemaData.java Tue Jan 22 07:51:31 2013
@@ -44,6 +44,8 @@ import org.apache.torque.test.peer.CompI
 import org.apache.torque.test.peer.CompNonpkFkPeer;
 import org.apache.torque.test.peer.CompPkContainsFkPeer;
 import org.apache.torque.test.peer.CompPkOtherFkPeer;
+import org.apache.torque.test.peer.MultiRefPeer;
+import org.apache.torque.test.peer.MultiRefSameTablePeer;
 import org.apache.torque.test.peer.NonPkOIntegerFkPeer;
 import org.apache.torque.test.peer.NonPkPIntegerFkPeer;
 import org.apache.torque.test.peer.NullableOIntegerFkPeer;
@@ -710,6 +712,8 @@ public class ForeignKeySchemaData
      */
     public static void clearTablesInDatabase() throws TorqueException
     {
+        MultiRefSameTablePeer.doDelete(new Criteria());
+        MultiRefPeer.doDelete(new Criteria());
         NullablePIntegerFkPeer.doDelete(new Criteria());
         RequiredPIntegerFkPeer.doDelete(new Criteria());
         NonPkPIntegerFkPeer.doDelete(new Criteria());

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/InitShutdownTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/InitShutdownTest.java?rev=1436782&r1=1436781&r2=1436782&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/InitShutdownTest.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/InitShutdownTest.java Tue Jan 22 07:51:31 2013
@@ -111,14 +111,7 @@ public class InitShutdownTest extends Te
 
     private void checkTorqueInitialisationWithOIntegerPk() throws TorqueException
     {
-        Criteria criteria = new Criteria();
-        NullableOIntegerFkPeer.doDelete(criteria);
-        criteria = new Criteria();
-        RequiredOIntegerFkPeer.doDelete(criteria);
-        criteria = new Criteria();
-        NonPkOIntegerFkPeer.doDelete(criteria);
-        criteria = new Criteria();
-        OIntegerPkPeer.doDelete(criteria);
+        ForeignKeySchemaData.clearTablesInDatabase();
 
         OIntegerPk oIntegerPk = new OIntegerPk();
         oIntegerPk.setName("shutdownName");
@@ -137,15 +130,6 @@ public class InitShutdownTest extends Te
 
     private void checkTorqueInitialisationWithPIntegerPk() throws TorqueException
     {
-        Criteria criteria = new Criteria();
-        NullablePIntegerFkPeer.doDelete(criteria);
-        criteria = new Criteria();
-        RequiredPIntegerFkPeer.doDelete(criteria);
-        criteria = new Criteria();
-        NonPkPIntegerFkPeer.doDelete(criteria);
-        criteria = new Criteria();
-        PIntegerPkPeer.doDelete(criteria);
-
         ForeignKeySchemaData.clearTablesInDatabase();
         PIntegerPk pIntegerPk = new PIntegerPk();
         pIntegerPk.setName("shutdownName");

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java?rev=1436782&r1=1436781&r2=1436782&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java Tue Jan 22 07:51:31 2013
@@ -11,9 +11,9 @@ import org.apache.torque.adapter.OracleA
 import org.apache.torque.criteria.Criteria;
 import org.apache.torque.om.StringKey;
 import org.apache.torque.test.dbobject.BitCompositePk;
-import org.apache.torque.test.dbobject.BitValue;
+import org.apache.torque.test.dbobject.BitType;
 import org.apache.torque.test.peer.BitCompositePkPeer;
-import org.apache.torque.test.peer.BitValuePeer;
+import org.apache.torque.test.peer.BitTypePeer;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -59,9 +59,9 @@ public class BitTest extends BaseDatabas
         List<BitCompositePk> bitCompositePks
                 = BitCompositePkPeer.doSelect(new Criteria());
         assertEquals(3, bitCompositePks.size());
-        List<BitValue> bitValues
-                = BitValuePeer.doSelect(new Criteria());
-        assertEquals(2, bitValues.size());
+        List<BitType> bitTypes
+                = BitTypePeer.doSelect(new Criteria());
+        assertEquals(2, bitTypes.size());
     }
 
     /**
@@ -143,13 +143,14 @@ public class BitTest extends BaseDatabas
         fillTables();
 
         // read data
-        BitValue bitValue = BitValuePeer.retrieveByPK(new StringKey("t1"));
+        BitType bitType = BitTypePeer.doSelectSingleRecord(
+                new Criteria().where(BitTypePeer.ID, "t1"));
         assertTrue("BIT should be true but is: "
-                + bitValue.getBitValue(), bitValue.getBitValue());
+                + bitType.getBitValue(), bitType.getBitValue());
 
-        bitValue = BitValuePeer.retrieveByPK(new StringKey("f1"));
+        bitType = BitTypePeer.retrieveByPK(new StringKey("f1"));
         assertFalse("BIT should be false but is: "
-                + bitValue.getBitValue(), bitValue.getBitValue());
+                + bitType.getBitValue(), bitType.getBitValue());
     }
 
     /**
@@ -166,17 +167,13 @@ public class BitTest extends BaseDatabas
         }
         // query data
         Criteria criteria = new Criteria()
-                .where(BitValuePeer.BIT_VALUE, new Boolean(true));
-        List<BitValue> bitValueList = BitValuePeer.doSelect(criteria);
-        assertTrue("Should have read 1 dataset "
-                + "but read " + bitValueList.size(),
-                bitValueList.size() == 1);
-        BitValue bitValue = bitValueList.get(0);
+                .where(BitTypePeer.BIT_VALUE, new Boolean(true));
+        List<BitType> bitTypeList = BitTypePeer.doSelect(criteria);
+        assertEquals(1, bitTypeList.size());
+        BitType bitType = bitTypeList.get(0);
         // use trim() for testkey because some databases will return the
         // testkey filled up with blanks, as it is defined as char(10)
-        assertTrue("Primary key of data set should be t1 but is "
-                + bitValue.getId(),
-                "t1".equals(bitValue.getId()));
+        assertEquals("t1", bitType.getId());
     }
 
     /**
@@ -192,12 +189,12 @@ public class BitTest extends BaseDatabas
             return;
         }
         Criteria criteria = new Criteria().where(
-                BitValuePeer.BIT_VALUE, new Boolean(false));
-        List<BitValue> bitValueList = BitValuePeer.doSelect(criteria);
+                BitTypePeer.BIT_VALUE, new Boolean(false));
+        List<BitType> bitTypeList = BitTypePeer.doSelect(criteria);
         assertTrue("Should have read 1 dataset "
-                + "but read " + bitValueList.size(),
-                bitValueList.size() == 1);
-        BitValue bitValue = bitValueList.get(0);
+                + "but read " + bitTypeList.size(),
+                bitTypeList.size() == 1);
+        BitType bitValue = bitTypeList.get(0);
         assertTrue("Primary key of data set should be f1 but is "
                 + bitValue.getId(),
                 "f1".equals(bitValue.getId()));
@@ -229,7 +226,7 @@ public class BitTest extends BaseDatabas
     private void fillTables() throws TorqueException
     {
         BitCompositePkPeer.doDelete(new Criteria());
-        BitValuePeer.doDelete(new Criteria());
+        BitTypePeer.doDelete(new Criteria());
 
         BitCompositePk bitCompositePk = new BitCompositePk();
         bitCompositePk.setPk1("false value");
@@ -249,14 +246,14 @@ public class BitTest extends BaseDatabas
         bitCompositePk.setPayload("payload");
         bitCompositePk.save();
 
-        BitValue bitValue = new BitValue();
-        bitValue.setId("t1");
-        bitValue.setBitValue(true);
-        bitValue.save();
-
-        bitValue = new BitValue();
-        bitValue.setId("f1");
-        bitValue.setBitValue(false);
-        bitValue.save();
+        BitType bitType = new BitType();
+        bitType.setId("t1");
+        bitType.setBitValue(true);
+        bitType.save();
+
+        bitType = new BitType();
+        bitType.setId("f1");
+        bitType.setBitValue(false);
+        bitType.save();
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message