db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henn...@apache.org
Subject cvs commit: db-torque/xdocs release-changes.xml
Date Mon, 17 May 2004 12:49:19 GMT
henning     2004/05/17 05:49:19

  Modified:    src/generator/src/templates/om Tag: TORQUE_3_1_HENNING
                        MapBuilder.vm
               src/java/org/apache/torque Tag: TORQUE_3_1_HENNING
                        TorqueInstance.java
               src/java/org/apache/torque/map Tag: TORQUE_3_1_HENNING
                        ColumnMap.java TableMap.java
               xdocs    Tag: TORQUE_3_1_HENNING release-changes.xml
  Removed:     proposals/henning/column-javaname Tag: TORQUE_3_1_HENNING
                        README column-javaname.patch
  Log:
  Added the column-javaname proposal to the TORQUE_3_1_HENNING branch.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.3.4.1   +6 -6      db-torque/src/generator/src/templates/om/MapBuilder.vm
  
  Index: MapBuilder.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/om/MapBuilder.vm,v
  retrieving revision 1.3
  retrieving revision 1.3.4.1
  diff -u -r1.3 -r1.3.4.1
  --- MapBuilder.vm	7 Aug 2003 13:13:00 -0000	1.3
  +++ MapBuilder.vm	17 May 2004 12:49:19 -0000	1.3.4.1
  @@ -121,19 +121,19 @@
     #set ( $cup=$col.Name.toUpperCase() )
     #if($col.isPrimaryKey())
       #if($col.isForeignKey())
  -        tMap.addForeignPrimaryKey(
  -                "${table.Name}.$cup", $col.JavaObject , "$col.RelatedTableName" ,
  +        tMap.addForeignPrimaryKeyWithJavaName(
  +                "${table.Name}.$cup", "$cfc", $col.JavaObject , "$col.RelatedTableName"
,
                   "$col.RelatedColumnName");
       #else
  -        tMap.addPrimaryKey("${table.Name}.$cup", $col.JavaObject);
  +        tMap.addPrimaryKeyWithJavaName("${table.Name}.$cup", "$cfc", $col.JavaObject);
       #end
     #else
       #if($col.isForeignKey())
  -        tMap.addForeignKey(
  -                "${table.Name}.$cup", $col.JavaObject , "$col.RelatedTableName" ,
  +        tMap.addForeignKeyWithJavaName(
  +                "${table.Name}.$cup", "$cfc", $col.JavaObject , "$col.RelatedTableName"
,
                   "$col.RelatedColumnName");
       #else
  -        tMap.addColumn("${table.Name}.$cup", $col.JavaObject);
  +        tMap.addColumnWithJavaName("${table.Name}.$cup", "$cfc", $col.JavaObject);
       #end
     #end
   #end
  
  
  
  No                   revision
  No                   revision
  1.5.2.1.2.1 +5 -5      db-torque/src/java/org/apache/torque/TorqueInstance.java
  
  Index: TorqueInstance.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/TorqueInstance.java,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.1.2.1
  diff -u -r1.5.2.1 -r1.5.2.1.2.1
  --- TorqueInstance.java	29 Feb 2004 23:14:11 -0000	1.5.2.1
  +++ TorqueInstance.java	17 May 2004 12:49:19 -0000	1.5.2.1.2.1
  @@ -661,10 +661,10 @@
       {
           map.setIdTable("ID_TABLE");
           TableMap tMap = map.getIdTable();
  -        tMap.addPrimaryKey("ID_TABLE_ID", new Integer(0));
  -        tMap.addColumn("TABLE_NAME", "");
  -        tMap.addColumn("NEXT_ID", new Integer(0));
  -        tMap.addColumn("QUANTITY", new Integer(0));
  +        tMap.addPrimaryKeyWithJavaName("ID_TABLE_ID", "IdTableId", new Integer(0));
  +        tMap.addColumnWithJavaName("TABLE_NAME", "TableName", "");
  +        tMap.addColumnWithJavaName("NEXT_ID", "NextId", new Integer(0));
  +        tMap.addColumnWithJavaName("QUANTITY", "Quantity", new Integer(0));
       }
   
       /**
  
  
  
  No                   revision
  No                   revision
  1.7.2.1.2.1 +24 -1     db-torque/src/java/org/apache/torque/map/ColumnMap.java
  
  Index: ColumnMap.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/map/ColumnMap.java,v
  retrieving revision 1.7.2.1
  retrieving revision 1.7.2.1.2.1
  diff -u -r1.7.2.1 -r1.7.2.1.2.1
  --- ColumnMap.java	29 Feb 2004 23:14:12 -0000	1.7.2.1
  +++ ColumnMap.java	17 May 2004 12:49:19 -0000	1.7.2.1.2.1
  @@ -47,6 +47,9 @@
       /** The name of the column. */
       private String columnName;
   
  +    /** The java name of the column. */
  +    private String javaName;
  +
   
       /**
        * Constructor.
  @@ -68,6 +71,26 @@
       public String getColumnName()
       {
           return columnName;
  +    }
  +
  +    /**
  +     * Set the java name of this column.
  +     *
  +     * @param javaName The name for this property
  +     */
  +    public void setJavaName(String javaName)
  +    {
  +        this.javaName = javaName;
  +    }
  +
  +    /**
  +     * Get the java name of a column.
  +     *
  +     * @return A String with the column name.
  +     */
  +    public String getJavaName()
  +    {
  +        return javaName;
       }
   
       /**
  
  
  
  1.13.2.1.2.1 +160 -1    db-torque/src/java/org/apache/torque/map/TableMap.java
  
  Index: TableMap.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/map/TableMap.java,v
  retrieving revision 1.13.2.1
  retrieving revision 1.13.2.1.2.1
  diff -u -r1.13.2.1 -r1.13.2.1.2.1
  --- TableMap.java	29 Feb 2004 23:14:12 -0000	1.13.2.1
  +++ TableMap.java	17 May 2004 12:49:19 -0000	1.13.2.1.2.1
  @@ -289,6 +289,20 @@
       }
   
       /**
  +     * Add a column to this table of a certain type.
  +     *
  +     * @param columnName A String with the column name.
  +     * @param javaName A string with the Java property name
  +     * @param type An Object specifying the type.
  +     */
  +    public void addColumnWithJavaName(String columnName, 
  +                          String javaName,
  +                          Object type)
  +    {
  +        addColumnWithJavaName(columnName, javaName, type, false, null, null, 0);
  +    }
  +
  +    /**
        * Add a column to this table of a certain type and size.
        *
        * @param columnName A String with the column name.
  @@ -301,6 +315,22 @@
       }
   
       /**
  +     * Add a column to this table of a certain type and size.
  +     *
  +     * @param columnName A String with the column name.
  +     * @param javaName A string with the Java property name
  +     * @param type An Object specifying the type.
  +     * @param size An int specifying the size.
  +     */
  +    public void addColumnWithJavaName(String columnName,
  +                          String javaName,
  +                          Object type, 
  +                          int size)
  +    {
  +        addColumnWithJavaName(columnName, javaName, type, false, null, null, size);
  +    }
  +
  +    /**
        * Add a primary key column to this Table.
        *
        * @param columnName A String with the column name.
  @@ -315,6 +345,20 @@
        * Add a primary key column to this Table.
        *
        * @param columnName A String with the column name.
  +     * @param javaName A string with the Java property name
  +     * @param type An Object specifying the type.
  +     */
  +    public void addPrimaryKeyWithJavaName(String columnName,
  +                              String javaName,
  +                              Object type)
  +    {
  +        addColumnWithJavaName(columnName, javaName, type, true, null, null, 0);
  +    }
  +
  +    /**
  +     * Add a primary key column to this Table.
  +     *
  +     * @param columnName A String with the column name.
        * @param type An Object specifying the type.
        * @param size An int specifying the size.
        */
  @@ -324,6 +368,22 @@
       }
   
       /**
  +     * Add a primary key column to this Table.
  +     *
  +     * @param columnName A String with the column name.
  +     * @param javaName A string with the Java property name
  +     * @param type An Object specifying the type.
  +     * @param size An int specifying the size.
  +     */
  +    public void addPrimaryKeyWithJavaName(String columnName, 
  +                              String javaName,
  +                              Object type, 
  +                              int size)
  +    {
  +        addColumnWithJavaName(columnName, javaName, type, true, null, null, size);
  +    }
  +
  +    /**
        * Add a foreign key column to the table.
        *
        * @param columnName A String with the column name.
  @@ -343,6 +403,24 @@
        * Add a foreign key column to the table.
        *
        * @param columnName A String with the column name.
  +     * @param javaName A string with the Java property name
  +     * @param type An Object specifying the type.
  +     * @param fkTable A String with the foreign key table name.
  +     * @param fkColumn A String with the foreign key column name.
  +     */
  +    public void addForeignKeyWithJavaName(String columnName,
  +                              String javaName,
  +                              Object type,
  +                              String fkTable,
  +                              String fkColumn)
  +    {
  +        addColumnWithJavaName(columnName, javaName, type, false, fkTable, fkColumn, 0);
  +    }
  +
  +    /**
  +     * Add a foreign key column to the table.
  +     *
  +     * @param columnName A String with the column name.
        * @param type An Object specifying the type.
        * @param fkTable A String with the foreign key table name.
        * @param fkColumn A String with the foreign key column name.
  @@ -358,6 +436,26 @@
       }
   
       /**
  +     * Add a foreign key column to the table.
  +     *
  +     * @param columnName A String with the column name.
  +     * @param javaName A string with the Java property name
  +     * @param type An Object specifying the type.
  +     * @param fkTable A String with the foreign key table name.
  +     * @param fkColumn A String with the foreign key column name.
  +     * @param size An int specifying the size.
  +     */
  +    public void addForeignKeyWithJavaName(String columnName,
  +                              String javaName,
  +                              Object type,
  +                              String fkTable,
  +                              String fkColumn,
  +                              int size)
  +    {
  +        addColumnWithJavaName(columnName, javaName, type, false, fkTable, fkColumn, size);
  +    }
  +
  +    /**
        * Add a foreign primary key column to the table.
        *
        * @param columnName A String with the column name.
  @@ -377,6 +475,24 @@
        * Add a foreign primary key column to the table.
        *
        * @param columnName A String with the column name.
  +     * @param javaName A string with the Java property name
  +     * @param type An Object specifying the type.
  +     * @param fkTable A String with the foreign key table name.
  +     * @param fkColumn A String with the foreign key column name.
  +     */
  +    public void addForeignPrimaryKeyWithJavaName(String columnName,
  +                                     String javaName,
  +                                     Object type,
  +                                     String fkTable,
  +                                     String fkColumn)
  +    {
  +        addColumnWithJavaName(columnName, javaName, type, true, fkTable, fkColumn, 0);
  +    }
  +
  +    /**
  +     * Add a foreign primary key column to the table.
  +     *
  +     * @param columnName A String with the column name.
        * @param type An Object specifying the type.
        * @param fkTable A String with the foreign key table name.
        * @param fkColumn A String with the foreign key column name.
  @@ -392,6 +508,26 @@
       }
   
       /**
  +     * Add a foreign primary key column to the table.
  +     *
  +     * @param columnName A String with the column name.
  +     * @param javaName A string with the Java property name
  +     * @param type An Object specifying the type.
  +     * @param fkTable A String with the foreign key table name.
  +     * @param fkColumn A String with the foreign key column name.
  +     * @param size An int specifying the size.
  +     */
  +    public void addForeignPrimaryKeyWithJavaName(String columnName,
  +                                     String javaName,
  +                                     Object type,
  +                                     String fkTable,
  +                                     String fkColumn,
  +                                     int size)
  +    {
  +        addColumnWithJavaName(columnName, javaName, type, true, fkTable, fkColumn, size);
  +    }
  +
  +    /**
        * Add a column to the table.
        *
        * @param name A String with the column name.
  @@ -408,6 +544,28 @@
                              String fkColumn,
                              int size)
       {
  +        addColumnWithJavaName(name, name, type, pk, fkTable, fkColumn, size);
  +    }
  +
  +    /**
  +     * Add a column to the table.
  +     *
  +     * @param name A String with the column name.
  +     * @param javaName A string with the Java property name
  +     * @param type An Object specifying the type.
  +     * @param pk True if column is a primary key.
  +     * @param fkTable A String with the foreign key table name.
  +     * @param fkColumn A String with the foreign key column name.
  +     * @param size An int specifying the size.
  +     */
  +    private void addColumnWithJavaName(String name,
  +                           String javaName,
  +                           Object type,
  +                           boolean pk,
  +                           String fkTable,
  +                           String fkColumn,
  +                           int size)
  +    {
           // If the tablename is prefixed with the name of the column,
           // remove it ie: SCARAB_PROJECT.PROJECT_ID remove the
           // SCARAB_PROJECT.
  @@ -424,6 +582,7 @@
               }
           }
           ColumnMap col = new ColumnMap(name, this);
  +        col.setJavaName(javaName);
           col.setType(type);
           col.setPrimaryKey(pk);
           col.setForeignKey(fkTable, fkColumn);
  
  
  
  No                   revision
  No                   revision
  1.3.2.5.2.3 +17 -0     db-torque/xdocs/release-changes.xml
  
  Index: release-changes.xml
  ===================================================================
  RCS file: /home/cvs/db-torque/xdocs/release-changes.xml,v
  retrieving revision 1.3.2.5.2.2
  retrieving revision 1.3.2.5.2.3
  diff -u -r1.3.2.5.2.2 -r1.3.2.5.2.3
  --- release-changes.xml	17 May 2004 12:41:13 -0000	1.3.2.5.2.2
  +++ release-changes.xml	17 May 2004 12:49:19 -0000	1.3.2.5.2.3
  @@ -36,6 +36,23 @@
   </p>
   </subsection>
   
  +<subsection name="ColumnJavaName Patch">
  +<p>
  +The Map Builder had no facility to find the actual generated java
  +names of the peer objects. Where there was information about the
  +SQL names, the Java names (which can be different by using the <code>JavaName</code>
tag in your
  +database schema) were not available.<br/>
  +
  +<font color="red">This is a breaking change!</font> You must rebuild
  +your schema and your application with this patch because some of the
  +method signatures in the TableMap class are changed.<br/>
  +
  +If you're using Turbine and want to try out this experimental version
  +of Torque, you <b>must</b> rebuild your turbine.jar using the
  +torquex.jar. If you don't, your application will break because of
  +method signature errors!<br/>
  +</p>
  +</subsection>
   </section>
   
   <section name="Torque 3.1.1.">
  
  
  

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


Mime
View raw message