db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r383358 [3/5] - in /db/ojb/trunk: lib/ src/doc/forrest/src/documentation/content/xdocs/docu/guides/ src/xdoclet/java/src/xdoclet/modules/ojb/ src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ src/xdoclet/java/src/xdoclet/modules/ojb/mod...
Date Sun, 05 Mar 2006 17:31:12 GMT
Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTableAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTableAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTableAttributeTests.java (original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTableAttributeTests.java Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2006 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
 /**
  * Tests for the ojb.collection tag with the indirection-table attribute.
  *
- * @author <a href="mailto:tomdz@users.sourceforge.net">Thomas Dudziak (tomdz@users.sourceforge.net)</a>
+ * @author Thomas Dudziak
  */
 public class CollectionTagIndirectionTableAttributeTests extends OjbTestBase
 {
@@ -1304,6 +1304,1885 @@
             "        <column name=\"id\"\n"+
             "                javaName=\"id\"\n"+
             "                type=\"INTEGER\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey-names in both collections specified
+    public void testForeignkeyNames1()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-name=\"FKToA\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-name=\"FKToB\"\n"+
+            "    */\n"+
+            "  private "+TestCollectionClass.class.getName()+" as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        collection-class=\""+TestCollectionClass.class.getName()+"\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key name=\"FKToA\" foreignTable=\"A\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key name=\"FKToB\" foreignTable=\"B\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey-name and remote-foreignky-name only in one of the collections specified
+    public void testForeignkeyNames2()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-name=\"FKToB\"\n"+
+            "    *                 remote-foreignkey-name=\"FKToA\"\n"+
+            "    */\n"+
+            "  private "+TestCollectionClass.class.getName()+" as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        collection-class=\""+TestCollectionClass.class.getName()+"\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key name=\"FKToA\" foreignTable=\"A\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key name=\"FKToB\" foreignTable=\"B\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: only foreignkey-name in one of the collections specified
+    public void testForeignkeyNames3()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-name=\"FKToB\"\n"+
+            "    */\n"+
+            "  private "+TestCollectionClass.class.getName()+" as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        collection-class=\""+TestCollectionClass.class.getName()+"\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key foreignTable=\"A\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key name=\"FKToB\" foreignTable=\"B\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+
+    // Test: only remote-foreignky-name in one of the collections specified
+    public void testForeignkeyNames4()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 remote-foreignkey-name=\"FKToB\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private "+TestCollectionClass.class.getName()+" as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        collection-class=\""+TestCollectionClass.class.getName()+"\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key foreignTable=\"A\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key name=\"FKToB\" foreignTable=\"B\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey-on-delete in both collections specified
+    public void testForeignkeyOnDelete1()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-delete=\"restrict\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-delete=\"none\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key foreignTable=\"A\" onDelete=\"restrict\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key foreignTable=\"B\" onDelete=\"none\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey-on-delete and remote-foreignkey-on-delete in one collection specified
+    public void testForeignkeyOnDelete2()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-delete=\"setnull\"\n"+
+            "    *                 remote-foreignkey-on-delete=\"cascade\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key foreignTable=\"A\" onDelete=\"setnull\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key foreignTable=\"B\" onDelete=\"cascade\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: only one foreignkey-on-delete specified
+    public void testForeignkeyOnDelete3()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-delete=\"cascade\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key foreignTable=\"A\" onDelete=\"cascade\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key foreignTable=\"B\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: only one remote-foreignkey-on-delete specified
+    public void testForeignkeyOnDelete4()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 remote-foreignkey-on-delete=\"cascade\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key foreignTable=\"A\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key foreignTable=\"B\" onDelete=\"cascade\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey-on-delete without a value specified
+    public void testForeignkeyOnDelete5()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-delete=\"\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertNull(runOjbXDoclet(OJB_DEST_FILE));
+        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey-on-delete with an illegal value specified
+    public void testForeignkeyOnDelete6()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-delete=\"illegal\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertNull(runOjbXDoclet(OJB_DEST_FILE));
+        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: remote-foreignkey-on-delete without a value specified
+    public void testForeignkeyOnDelete7()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 remote-foreignkey-on-delete=\"\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertNull(runOjbXDoclet(OJB_DEST_FILE));
+        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: remote-foreignkey-on-delete with an illegal value specified
+    public void testForeignkeyOnDelete8()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 remote-foreignkey-on-delete=\"illegal\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertNull(runOjbXDoclet(OJB_DEST_FILE));
+        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey-on-update in both collections specified
+    public void testForeignkeyOnUpdate1()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-update=\"restrict\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-update=\"none\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key foreignTable=\"A\" onUpdate=\"restrict\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key foreignTable=\"B\" onUpdate=\"none\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey-on-update and remote-foreignkey-on-update in one collection specified
+    public void testForeignkeyOnUpdate2()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-update=\"setnull\"\n"+
+            "    *                 remote-foreignkey-on-update=\"cascade\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key foreignTable=\"A\" onUpdate=\"setnull\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key foreignTable=\"B\" onUpdate=\"cascade\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: only one foreignkey-on-update specified
+    public void testForeignkeyOnUpdate3()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-update=\"cascade\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key foreignTable=\"A\" onUpdate=\"cascade\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key foreignTable=\"B\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: only one remote-foreignkey-on-update specified
+    public void testForeignkeyOnUpdate4()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 remote-foreignkey-on-update=\"cascade\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key foreignTable=\"A\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key foreignTable=\"B\" onUpdate=\"cascade\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey-on-update without a value specified
+    public void testForeignkeyOnUpdate5()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-update=\"\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertNull(runOjbXDoclet(OJB_DEST_FILE));
+        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey-on-update with an illegal value specified
+    public void testForeignkeyOnUpdate6()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-update=\"illegal\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertNull(runOjbXDoclet(OJB_DEST_FILE));
+        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: remote-foreignkey-on-update without a value specified
+    public void testForeignkeyOnUpdate7()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 remote-foreignkey-on-update=\"\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertNull(runOjbXDoclet(OJB_DEST_FILE));
+        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: remote-foreignkey-on-update with an illegal value specified
+    public void testForeignkeyOnUpdate8()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 remote-foreignkey-on-update=\"illegal\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertNull(runOjbXDoclet(OJB_DEST_FILE));
+        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: both foreignkey-on-delete and foreignkey-on-update specified on both collections
+    public void testForeignkeyOnDeleteAndOnUpdate1()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-delete=\"setnull\"\n"+
+            "    *                 foreignkey-on-update=\"restrict\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-delete=\"none\"\n"+
+            "    *                 foreignkey-on-update=\"cascade\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key foreignTable=\"A\" onDelete=\"setnull\" onUpdate=\"restrict\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key foreignTable=\"B\" onDelete=\"none\" onUpdate=\"cascade\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: both foreignkey-on-delete and foreignkey-on-update specified, all on only one collection
+    public void testForeignkeyOnDeleteAndOnUpdate2()
+    {
+        addClass(
+            "test.A",
+            "package test;\n"+
+            "/** @ojb.class */\n" +
+            "public class A {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private org.apache.ojb.broker.util.GUID id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
+            "    *                 foreignkey=\"AID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    *                 foreignkey-on-delete=\"cascade\"\n"+
+            "    *                 foreignkey-on-update=\"none\"\n"+
+            "    *                 remote-foreignkey-on-delete=\"setnull\"\n"+
+            "    *                 remote-foreignkey-on-update=\"restrict\"\n"+
+            "    */\n"+
+            "  private java.util.List bs;\n"+
+            "}");
+        addClass(
+            "test.B",
+            "package test;\n"+
+            "/** @ojb.class */\n"+
+            "public class B {\n"+
+            "  /** @ojb.field primarykey=\"true\" */\n"+
+            "  private java.util.Date id;\n"+
+            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
+            "    *                 foreignkey=\"BID\"\n"+
+            "    *                 indirection-table=\"A_B\"\n"+
+            "    */\n"+
+            "  private java.util.List as;\n"+
+            "}\n");
+
+        assertEqualsOjbDescriptorFile(
+            "<class-descriptor\n"+
+            "    class=\"test.A\"\n"+
+            "    table=\"A\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"VARCHAR\"\n"+
+            "        primarykey=\"true\"\n"+
+            "        conversion=\"org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion\"\n"+
+            "        length=\"254\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"bs\"\n"+
+            "        element-class-ref=\"test.B\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"AID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"BID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>\n"+
+            "<class-descriptor\n"+
+            "    class=\"test.B\"\n"+
+            "    table=\"B\"\n"+
+            ">\n"+
+            "    <field-descriptor\n"+
+            "        name=\"id\"\n"+
+            "        column=\"id\"\n"+
+            "        jdbc-type=\"DATE\"\n"+
+            "        primarykey=\"true\"\n"+
+            "    >\n"+
+            "    </field-descriptor>\n"+
+            "    <collection-descriptor\n"+
+            "        name=\"as\"\n"+
+            "        element-class-ref=\"test.A\"\n"+
+            "        indirection-table=\"A_B\"\n"+
+            "    >\n"+
+            "        <fk-pointing-to-this-class column=\"BID\"/>\n"+
+            "        <fk-pointing-to-element-class column=\"AID\"/>\n"+
+            "    </collection-descriptor>\n"+
+            "</class-descriptor>",
+            runOjbXDoclet(OJB_DEST_FILE));
+        assertEqualsTorqueSchemaFile(
+            "<database name=\"ojbtest\">\n"+
+            "    <table name=\"A\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                primaryKey=\"true\"\n"+
+            "                required=\"true\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "    </table>\n"+
+            "    <table name=\"A_B\">\n"+
+            "        <column name=\"AID\"\n"+
+            "                type=\"VARCHAR\"\n"+
+            "                size=\"254\"\n"+
+            "        />\n"+
+            "        <column name=\"BID\"\n"+
+            "                type=\"DATE\"\n"+
+            "        />\n"+
+            "        <foreign-key foreignTable=\"A\" onDelete=\"cascade\" onUpdate=\"none\">\n"+
+            "            <reference local=\"AID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "        <foreign-key foreignTable=\"B\" onDelete=\"setnull\" onUpdate=\"restrict\">\n"+
+            "            <reference local=\"BID\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "    <table name=\"B\">\n"+
+            "        <column name=\"id\"\n"+
+            "                javaName=\"id\"\n"+
+            "                type=\"DATE\"\n"+
             "                primaryKey=\"true\"\n"+
             "                required=\"true\"\n"+
             "        />\n"+

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTableDocumentationAttributesTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTableDocumentationAttributesTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTableDocumentationAttributesTests.java (original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTableDocumentationAttributesTests.java Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTablePrimarykeysAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTablePrimarykeysAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTablePrimarykeysAttributeTests.java (original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTablePrimarykeysAttributeTests.java Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagOrderbyAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagOrderbyAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagOrderbyAttributeTests.java (original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagOrderbyAttributeTests.java Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagOtmDependentAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagOtmDependentAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagOtmDependentAttributeTests.java (original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagOtmDependentAttributeTests.java Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagProxyAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagProxyAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagProxyAttributeTests.java (original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagProxyAttributeTests.java Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagQueryCustomizerAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagQueryCustomizerAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagQueryCustomizerAttributeTests.java (original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagQueryCustomizerAttributeTests.java Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagRefreshAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagRefreshAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagRefreshAttributeTests.java (original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagRefreshAttributeTests.java Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.



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


Mime
View raw message