You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by to...@apache.org on 2004/06/11 00:34:24 UTC

cvs commit: db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/model PropertyHelper.java

tomdz       2004/06/10 15:34:23

  Modified:    .        build-xdoclet-module.xml .classpath
               src/xdoclet/test/xdoclet/modules/ojb/tests
                        CollectionTagIndirectionTableAttributeTests.java
               src/xdoclet/java/src/xdoclet/modules/ojb OjbTagsHandler.java
                        OjbSubTask.java TorqueSubTask.java
               src/xdoclet/java/src/xdoclet/modules/ojb/constraints
                        FieldDescriptorConstraints.java
                        ModelConstraints.java
               src/xdoclet/java/src/xdoclet/modules/ojb/model
                        PropertyHelper.java
  Added:       lib      xdoclet-1.2.1.jar xjavadoc-1.0.3.jar
                        xdoclet-ojb-module-1.2.1.jar
  Removed:     lib      xdoclet-1.2.jar xdoclet-ojb-module-1.2.jar
                        xjavadoc-1.0.2.jar
  Log:
  * Fixed bug submitted by Bradford Pielech concerning indirection tables for a collection that reference the same class that it is defined in
  * Added warning when a field of type java.util.Date without a conversion is encountered
  * Updated to XDoclet 1.2.1 (xdoclet and xjavadoc jars are now from the official binary distribution, not generated from source)
  
  Revision  Changes    Path
  1.9       +6 -16     db-ojb/build-xdoclet-module.xml
  
  Index: build-xdoclet-module.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/build-xdoclet-module.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- build-xdoclet-module.xml	5 Apr 2004 13:58:58 -0000	1.8
  +++ build-xdoclet-module.xml	10 Jun 2004 22:34:22 -0000	1.9
  @@ -117,21 +117,8 @@
           </ant>
       </target>
   
  -    <!-- Copies the generated jars (xjavadoc, xdoclet, ojb module) into the OJB lib folder -->
  +    <!-- Copies the generated jar into the OJB lib folder -->
       <target name="copy-xdoclet-jars">
  -        <!-- XJavaDoc core jar -->
  -        <copy todir="${lib}">
  -            <fileset dir="${xdoclet.src.dir}/lib">
  -                <include name="xjavadoc*.jar"/>
  -            </fileset>
  -        </copy>
  -        <!-- XDoclet core jar -->
  -        <copy todir="${lib}">
  -            <fileset dir="${xdoclet.src.dir}/target/lib">
  -                <include name="xdoclet*.jar"/>
  -                <exclude name="xdoclet*-module-*.jar"/>
  -            </fileset>
  -        </copy>
           <!-- XDoclet OJB module jar -->
           <copy todir="${lib}">
               <fileset dir="${xdoclet.src.dir}/target/lib">
  @@ -171,8 +158,8 @@
           </copy>
       </target>
   
  -    <!-- Compiles the test cases -->
  -    <target name="compile-test" depends="prepare-test,build,build-ojb">
  +    <!-- Compiles only the test cases -->
  +    <target name="compile-test-only" depends="prepare-test">
           <javac srcdir="${build.xdoclettest.src}"
                  destdir="${build.xdoclettest.dest}"
                  debug="on"
  @@ -181,6 +168,9 @@
           </javac>
       </target>
   
  +    <!-- Compiles the test cases -->
  +    <target name="compile-test" depends="build,build-ojb,compile-test-only"/>
  +    
       <!-- Runs the tests without preparing or compiling them -->
       <target name="junit-no-compile">
           <echo message="This target might not properly work with Ant older than 1.6.0"/>
  
  
  
  1.34      +2 -2      db-ojb/.classpath
  
  Index: .classpath
  ===================================================================
  RCS file: /home/cvs/db-ojb/.classpath,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- .classpath	6 Jun 2004 07:31:34 -0000	1.33
  +++ .classpath	10 Jun 2004 22:34:22 -0000	1.34
  @@ -28,8 +28,8 @@
   	<classpathentry kind="lib" path="lib/torque-3.0.2.jar"/>
   	<classpathentry kind="lib" path="lib/velocity-1.3.1.jar"/>
   	<classpathentry kind="lib" path="lib/prevayler.jar"/>
  -	<classpathentry kind="lib" path="lib/xdoclet-1.2.jar"/>
  -	<classpathentry kind="lib" path="lib/xjavadoc-1.0.2.jar"/>
  +	<classpathentry kind="lib" path="lib/xdoclet-1.2.1.jar"/>
  +	<classpathentry kind="lib" path="lib/xjavadoc-1.0.3.jar"/>
   	<classpathentry kind="lib" path="lib/antlr-2.7.3.jar"/>
   	<classpathentry kind="lib" path="lib/ant-1.6.0.jar"/>
   	<classpathentry kind="lib" path="lib/ant-junit.jar"/>
  
  
  
  1.8       +209 -39   db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTableAttributeTests.java
  
  Index: CollectionTagIndirectionTableAttributeTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagIndirectionTableAttributeTests.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CollectionTagIndirectionTableAttributeTests.java	5 Apr 2004 12:16:16 -0000	1.7
  +++ CollectionTagIndirectionTableAttributeTests.java	10 Jun 2004 22:34:22 -0000	1.8
  @@ -427,42 +427,8 @@
               runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
       }
   
  -    // Test: indirection-table with two classes, remote-foreignkey used but specifies wrong column
  -    public void testIndirectionTable6()
  -    {
  -        addClass(
  -            "test.A",
  -            "package test;\n"+
  -            "/** @ojb.class */\n" +
  -            "public class A {\n"+
  -            "  /** @ojb.field primarykey=\"true\" */\n"+
  -            "  private int id;\n"+
  -            "  /** @ojb.collection foreignkey=\"AID\"\n"+
  -            "    *                 indirection-table=\"A_B\"\n"+
  -            "    */\n"+
  -            "  private B[] bs;\n"+
  -            "}");
  -        addClass(
  -            "test.B",
  -            "package test;\n"+
  -            "/** @ojb.class */\n"+
  -            "public class B {\n"+
  -            "  /** @ojb.field primarykey=\"true\" */\n"+
  -            "  private int id;\n"+
  -            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
  -            "    *                 foreignkey=\"BID\"\n"+
  -            "    *                 remote-foreignkey=\"CID\"\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: indirection-table with two classes (only one with collection) but no remote-foreignkey given
  -    public void testIndirectionTable7()
  +    public void testIndirectionTable6()
       {
           addClass(
               "test.A",
  @@ -491,7 +457,7 @@
       }
   
       // Test: indirection-table with two classes (only one with collection) but remote-foreignkey has empty value
  -    public void testIndirectionTable8()
  +    public void testIndirectionTable7()
       {
           addClass(
               "test.A",
  @@ -521,7 +487,7 @@
       }
   
       // Test: indirection-table with two classes (only one with collection), remote-foreignkey used with one foreignkey
  -    public void testIndirectionTable9()
  +    public void testIndirectionTable8()
       {
           addClass(
               "test.A",
  @@ -620,7 +586,7 @@
       }
   
       // Test: indirection-table with two classes (only one with collection), remote-foreignkey used with multiple foreignkeys
  -    public void testIndirectionTable10()
  +    public void testIndirectionTable9()
       {
           addClass(
               "test.A",
  @@ -782,7 +748,7 @@
       }
   
       // Test: inherited indirection-table with two classes (both with collection)
  -    public void testIndirectionTable11()
  +    public void testIndirectionTable10()
       {
           addClass(
               "test.A",
  @@ -917,6 +883,210 @@
               "                required=\"true\"\n"+
               "                size=\"254\"\n"+
               "        />\n"+
  +            "    </table>\n"+
  +            "</database>",
  +            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: indirection-table for an association of a class to itself
  +    public void testIndirectionTable11()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
  +            "    *                 foreignkey=\"CHILD_ID\"\n"+
  +            "    *                 indirection-table=\"A_B\"\n"+
  +            "    */\n"+
  +            "  private java.util.Collection children;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
  +            "    *                 foreignkey=\"PARENT_ID\"\n"+
  +            "    *                 indirection-table=\"A_B\"\n"+
  +            "    */\n"+
  +            "  private java.util.Collection parents;\n"+
  +            "}");
  +
  +        assertEqualsOjbDescriptorFile(
  +            "<class-descriptor\n"+
  +            "    class=\"test.A\"\n"+
  +            "    table=\"A\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id\"\n"+
  +            "        column=\"id\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"children\"\n"+
  +            "        element-class-ref=\"test.A\"\n"+
  +            "        indirection-table=\"A_B\"\n"+
  +            "    >\n"+
  +            "        <fk-pointing-to-this-class column=\"CHILD_ID\"/>\n"+
  +            "        <fk-pointing-to-element-class column=\"PARENT_ID\"/>\n"+
  +            "    </collection-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"parents\"\n"+
  +            "        element-class-ref=\"test.A\"\n"+
  +            "        indirection-table=\"A_B\"\n"+
  +            "    >\n"+
  +            "        <fk-pointing-to-this-class column=\"PARENT_ID\"/>\n"+
  +            "        <fk-pointing-to-element-class column=\"CHILD_ID\"/>\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=\"INTEGER\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "    <table name=\"A_B\">\n"+
  +            "        <column name=\"CHILD_ID\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "        <column name=\"PARENT_ID\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "        <foreign-key foreignTable=\"A\">\n"+
  +            "            <reference local=\"CHILD_ID\" foreign=\"id\"/>\n"+
  +            "        </foreign-key>\n"+
  +            "        <foreign-key foreignTable=\"A\">\n"+
  +            "            <reference local=\"PARENT_ID\" foreign=\"id\"/>\n"+
  +            "        </foreign-key>\n"+
  +            "    </table>\n"+
  +            "</database>",
  +            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: two indirection-table for associations of a class to itself with specified remote foreignkeys
  +    public void testIndirectionTable12()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
  +            "    *                 foreignkey=\"PARENT_ID\"\n"+
  +            "    *                 remote-foreignkey=\"CHILD_ID\"\n"+
  +            "    *                 indirection-table=\"PARENT_CHILD\"\n"+
  +            "    */\n"+
  +            "  private java.util.Collection children;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
  +            "    *                 foreignkey=\"CHILD_ID\"\n"+
  +            "    *                 remote-foreignkey=\"PARENT_ID\"\n"+
  +            "    *                 indirection-table=\"PARENT_CHILD\"\n"+
  +            "    */\n"+
  +            "  private java.util.Collection parents;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
  +            "    *                 foreignkey=\"RIGHT_ID\"\n"+
  +            "    *                 remote-foreignkey=\"LEFT_ID\"\n"+
  +            "    *                 indirection-table=\"NEIGHBOURS\"\n"+
  +            "    */\n"+
  +            "  private java.util.Collection leftNeighbors;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.A\"\n"+
  +            "    *                 foreignkey=\"LEFT_ID\"\n"+
  +            "    *                 remote-foreignkey=\"RIGHT_ID\"\n"+
  +            "    *                 indirection-table=\"NEIGHBOURS\"\n"+
  +            "    */\n"+
  +            "  private java.util.Collection rightNeighbors;\n"+
  +            "}");
  +
  +        assertEqualsOjbDescriptorFile(
  +            "<class-descriptor\n"+
  +            "    class=\"test.A\"\n"+
  +            "    table=\"A\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id\"\n"+
  +            "        column=\"id\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"children\"\n"+
  +            "        element-class-ref=\"test.A\"\n"+
  +            "        indirection-table=\"PARENT_CHILD\"\n"+
  +            "    >\n"+
  +            "        <fk-pointing-to-this-class column=\"PARENT_ID\"/>\n"+
  +            "        <fk-pointing-to-element-class column=\"CHILD_ID\"/>\n"+
  +            "    </collection-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"parents\"\n"+
  +            "        element-class-ref=\"test.A\"\n"+
  +            "        indirection-table=\"PARENT_CHILD\"\n"+
  +            "    >\n"+
  +            "        <fk-pointing-to-this-class column=\"CHILD_ID\"/>\n"+
  +            "        <fk-pointing-to-element-class column=\"PARENT_ID\"/>\n"+
  +            "    </collection-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"leftNeighbors\"\n"+
  +            "        element-class-ref=\"test.A\"\n"+
  +            "        indirection-table=\"NEIGHBOURS\"\n"+
  +            "    >\n"+
  +            "        <fk-pointing-to-this-class column=\"RIGHT_ID\"/>\n"+
  +            "        <fk-pointing-to-element-class column=\"LEFT_ID\"/>\n"+
  +            "    </collection-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"rightNeighbors\"\n"+
  +            "        element-class-ref=\"test.A\"\n"+
  +            "        indirection-table=\"NEIGHBOURS\"\n"+
  +            "    >\n"+
  +            "        <fk-pointing-to-this-class column=\"LEFT_ID\"/>\n"+
  +            "        <fk-pointing-to-element-class column=\"RIGHT_ID\"/>\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=\"INTEGER\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "    <table name=\"NEIGHBOURS\">\n"+
  +            "        <column name=\"RIGHT_ID\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "        <column name=\"LEFT_ID\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "        <foreign-key foreignTable=\"A\">\n"+
  +            "            <reference local=\"RIGHT_ID\" foreign=\"id\"/>\n"+
  +            "        </foreign-key>\n"+
  +            "        <foreign-key foreignTable=\"A\">\n"+
  +            "            <reference local=\"LEFT_ID\" foreign=\"id\"/>\n"+
  +            "        </foreign-key>\n"+
  +            "    </table>\n"+
  +            "    <table name=\"PARENT_CHILD\">\n"+
  +            "        <column name=\"PARENT_ID\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "        <column name=\"CHILD_ID\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "        <foreign-key foreignTable=\"A\">\n"+
  +            "            <reference local=\"PARENT_ID\" foreign=\"id\"/>\n"+
  +            "        </foreign-key>\n"+
  +            "        <foreign-key foreignTable=\"A\">\n"+
  +            "            <reference local=\"CHILD_ID\" foreign=\"id\"/>\n"+
  +            "        </foreign-key>\n"+
               "    </table>\n"+
               "</database>",
               runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  
  
  
  1.12      +3 -1      db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java
  
  Index: OjbTagsHandler.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- OjbTagsHandler.java	5 Apr 2004 00:32:30 -0000	1.11
  +++ OjbTagsHandler.java	10 Jun 2004 22:34:22 -0000	1.12
  @@ -761,7 +761,9 @@
               attrName = (String)attrNames.nextElement();
               fieldDef.setProperty(attrName, attributes.getProperty(attrName));
           }
  -        // storing default info for later use
  +        // storing additional info for later use
  +        fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_JAVA_TYPE,
  +                             OjbMemberTagsHandler.getMemberType().getQualifiedName());
           fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_JDBC_TYPE, defaultType);
           if (defaultConversion != null)
           {    
  
  
  
  1.5       +1 -0      db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/OjbSubTask.java
  
  Index: OjbSubTask.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/OjbSubTask.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- OjbSubTask.java	5 Apr 2004 00:32:30 -0000	1.4
  +++ OjbSubTask.java	10 Jun 2004 22:34:22 -0000	1.5
  @@ -39,6 +39,7 @@
       {
           setTemplateURL(getClass().getResource(OJB_TEMPLATE_FILE));
           setDestinationFile(OJB_REPOSITORY_FILE_NAME);
  +        setSubTaskName("ojbrepository");
       }
   
       /**
  
  
  
  1.5       +1 -0      db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/TorqueSubTask.java
  
  Index: TorqueSubTask.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/TorqueSubTask.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TorqueSubTask.java	5 Apr 2004 00:32:30 -0000	1.4
  +++ TorqueSubTask.java	10 Jun 2004 22:34:22 -0000	1.5
  @@ -50,6 +50,7 @@
       {
           setTemplateURL(getClass().getResource(TORQUE_TEMPLATE_FILE));
           setDestinationFile(TORQUE_DEFAULT_FILE_NAME);
  +        setSubTaskName("torqueschema");
       }
   
       /**
  
  
  
  1.1                  db-ojb/lib/xdoclet-1.2.1.jar
  
  	<<Binary file>>
  
  
  1.1                  db-ojb/lib/xjavadoc-1.0.3.jar
  
  	<<Binary file>>
  
  
  1.1                  db-ojb/lib/xdoclet-ojb-module-1.2.1.jar
  
  	<<Binary file>>
  
  
  1.8       +14 -0     db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java
  
  Index: FieldDescriptorConstraints.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FieldDescriptorConstraints.java	5 Apr 2004 00:32:30 -0000	1.7
  +++ FieldDescriptorConstraints.java	10 Jun 2004 22:34:23 -0000	1.8
  @@ -179,6 +179,20 @@
               return;
           }
   
  +        // we issue a warning if we encounter a field with a java.util.Date java type without a conversion
  +        if ("java.util.Date".equals(fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_JAVA_TYPE)) &&
  +            !fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_CONVERSION))
  +        {
  +            LogHelper.warn(true,
  +                           FieldDescriptorConstraints.class,
  +                           "ensureConversion",
  +                           "The field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName()+
  +                               " of type java.util.Date is directly mapped to jdbc-type "+
  +                               fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE)+
  +                               ". However, most JDBC drivers can't handle java.util.Date directly so you might want to "+
  +                               " use a conversion for converting it to a JDBC datatype like TIMESTAMP.");
  +        }
  +
           String conversionClass = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_CONVERSION);
   
           if (((conversionClass == null) || (conversionClass.length() == 0)) &&
  
  
  
  1.6       +5 -1      db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ModelConstraints.java
  
  Index: ModelConstraints.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ModelConstraints.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ModelConstraints.java	5 Apr 2004 00:32:30 -0000	1.5
  +++ ModelConstraints.java	10 Jun 2004 22:34:23 -0000	1.6
  @@ -182,13 +182,17 @@
           ModelDef                modelDef      = (ModelDef)collDef.getOwner().getOwner();
           ClassDescriptorDef      elementClass  = modelDef.getClass(collDef.getProperty(PropertyHelper.OJB_PROPERTY_ELEMENT_CLASS_REF));
           String                  indirTable    = collDef.getProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE);
  +        boolean                 hasRemoteKey  = collDef.hasProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY);
  +        String                  remoteKey     = collDef.getProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY);
           CollectionDescriptorDef remoteCollDef = null;
   
           // find the collection in the element class that has the same indirection table
           for (Iterator it = elementClass.getCollections(); it.hasNext();)
           {
               remoteCollDef = (CollectionDescriptorDef)it.next();
  -            if (indirTable.equals(remoteCollDef.getProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE)))
  +            if (indirTable.equals(remoteCollDef.getProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE)) &&
  +                (collDef != remoteCollDef) &&
  +                (!hasRemoteKey || remoteKey.equals(remoteCollDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY))))
               {
                   return remoteCollDef;
               }
  
  
  
  1.6       +1 -0      db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/model/PropertyHelper.java
  
  Index: PropertyHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/model/PropertyHelper.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PropertyHelper.java	5 Apr 2004 00:32:31 -0000	1.5
  +++ PropertyHelper.java	10 Jun 2004 22:34:23 -0000	1.6
  @@ -59,6 +59,7 @@
       public static final String OJB_PROPERTY_INDIRECTION_TABLE           = "indirection-table";
       public static final String OJB_PROPERTY_INITIALIZATION_METHOD       = "initialization-method";
       public static final String OJB_PROPERTY_ISOLATION_LEVEL             = "isolation-level";
  +    public static final String OJB_PROPERTY_JAVA_TYPE                   = "java-type";
       public static final String OJB_PROPERTY_JDBC_TYPE                   = "jdbc-type";
       public static final String OJB_PROPERTY_LENGTH                      = "length";
       public static final String OJB_PROPERTY_LOCKING                     = "locking";
  
  
  

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