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/02/12 15:33:41 UTC

cvs commit: db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/constraints JdbcTypeHelper.java

tomdz       2004/02/12 06:33:41

  Modified:    src/xdoclet/test/xdoclet/modules/ojb/tests
                        FieldTagLengthAttributeTests.java
               lib      xdoclet-ojb-module-1.2.jar
               src/xdoclet/java/src/xdoclet/modules/ojb/constraints
                        JdbcTypeHelper.java
  Log:
  Fixed bug submitted by Joris Wijlens where a length attribute was enforced by the xdoclet ojb module for a LONGVARCHAR field
  
  Revision  Changes    Path
  1.2       +37 -0     db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/FieldTagLengthAttributeTests.java
  
  Index: FieldTagLengthAttributeTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/FieldTagLengthAttributeTests.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FieldTagLengthAttributeTests.java	15 Dec 2003 20:09:10 -0000	1.1
  +++ FieldTagLengthAttributeTests.java	12 Feb 2004 14:33:40 -0000	1.2
  @@ -454,4 +454,41 @@
               "</database>",
               runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
       }
  +
  +    // Test: default type for field would have length attribute, but specified type has not
  +    public void testLength12()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class A {\n"+
  +            "/** @ojb.field jdbc-type=\"LONGVARCHAR\" */\n"+
  +            "  private String attr;\n"+
  +            "}\n");
  +
  +        assertEqualsOjbDescriptorFile(
  +            "<class-descriptor\n"+
  +            "    class=\"test.A\"\n"+
  +            "    table=\"A\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"attr\"\n"+
  +            "        column=\"attr\"\n"+
  +            "        jdbc-type=\"LONGVARCHAR\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "</class-descriptor>",
  +            runOjbXDoclet(OJB_DEST_FILE));
  +        assertEqualsTorqueSchemaFile(
  +            "<database name=\"ojbtest\">\n"+
  +            "    <table name=\"A\">\n"+
  +            "        <column name=\"attr\"\n"+
  +            "                javaName=\"attr\"\n"+
  +            "                type=\"LONGVARCHAR\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "</database>",
  +            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
   }
  
  
  
  1.8       +388 -365  db-ojb/lib/xdoclet-ojb-module-1.2.jar
  
  	<<Binary file>>
  
  
  1.2       +2 -3      db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/JdbcTypeHelper.java
  
  Index: JdbcTypeHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/JdbcTypeHelper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JdbcTypeHelper.java	18 Jan 2004 18:24:50 -0000	1.1
  +++ JdbcTypeHelper.java	12 Feb 2004 14:33:41 -0000	1.2
  @@ -122,9 +122,8 @@
                                "org.apache.ojb.broker.accesslayer.conversions.GUID2StringFieldConversion");
   
           // lengths
  -        _jdbcLengths.put("CHAR",        "1");
  -        _jdbcLengths.put("VARCHAR",     "24");
  -        _jdbcLengths.put("LONGVARCHAR", "24");
  +        _jdbcLengths.put("CHAR",    "1");
  +        _jdbcLengths.put("VARCHAR", "24");
   
           // precisions
           _jdbcPrecisions.put("DECIMAL", "20");
  
  
  

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