db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Fischer (JIRA)" <j...@apache.org>
Subject [jira] Commented: (TORQUE-44) Column names in generated classes are uppercase
Date Thu, 14 Sep 2006 08:47:24 GMT
    [ http://issues.apache.org/jira/browse/TORQUE-44?page=comments#action_12434614 ] 
            
Thomas Fischer commented on TORQUE-44:
--------------------------------------

I do not agree that one should not use the internal constants; they are exported as public
constants and are thus part of the API. However, I still think that keeping the case from
the schema.xml is good because it enlarges the set od supported databases. On the other hand,
there is no logical reason for transforming the constants to uppercase, except for that "it
was like this in the past".

I am afraid that in order to create a consistent framework, one sometimes has to make changes
that may impair backward compatibility. As there are easy workarounds in this case (like changing
all affected names in the schema.xml to uppercase), I thought that this change would be ok
in a minor version change. Given that we probably will not have am ajaor version change in
another year, I still think this decision was ok.

> Column names in generated classes are uppercase
> -----------------------------------------------
>
>                 Key: TORQUE-44
>                 URL: http://issues.apache.org/jira/browse/TORQUE-44
>             Project: Torque
>          Issue Type: Bug
>          Components: Generator
>    Affects Versions: 3.1, 3.1.1, 3.2
>            Reporter: Thoralf Rickert
>         Assigned To: Thomas Fischer
>             Fix For: 3.2.1
>
>         Attachments: patch.txt
>
>
> The generator creates constants for the column names in tables. The content of this constants
uses upper cases.
> For example if you have a table like:
> <table name="address">
>         <column name="class" javaName="aClass" primaryKey="true" required="true" size="2"
type="CHAR"/>
>         <column name="id" primaryKey="true" required="true" size="30" type="VARCHAR"/>
>         <column name="position" primaryKey="true" required="true" type="INTEGER"/>
>         <column name="name1" size="50" type="VARCHAR"/>
>         <column name="name2" size="50" type="VARCHAR"/>
>         <column name="name3" size="50" type="VARCHAR"/>
>         <column name="street" size="50" type="VARCHAR"/>
>         <column name="zipcode" size="25" type="VARCHAR"/>
>         <column name="city" size="60" type="VARCHAR"/>
>         <column name="phone" size="40" type="VARCHAR"/>
>         <column name="phone2" size="40" type="VARCHAR"/>
>         <column name="country" size="200" type="VARCHAR"/>
>         <column name="state" size="200" type="VARCHAR"/>
>         <column name="fax" size="40" type="VARCHAR"/>
>         <column name="email" size="150" type="VARCHAR"/>
> </table>
> The generator creates in the corresponding BaseAddressPeer the following constants.
> ...
>     static
>     {
>           CLASS = "address.CLASS";
>           ID = "address.ID";
>           POSITION = "address.POSITION";
>           NAME1 = "address.NAME1";
>           NAME2 = "address.NAME2";
>           NAME3 = "address.NAME3";
>           STREET = "address.STREET";
>           ZIPCODE = "address.ZIPCODE";
>           CITY = "address.CITY";
>           PHONE = "address.PHONE";
>           PHONE2 = "address.PHONE2";
>           COUNTRY = "address.COUNTRY";
>           STATE = "address.STATE";
>           FAX = "address.FAX";
>           EMAIL = "address.EMAIL";
>    ....
> but this variables should be for example "address.email".
> The AddressMapBuilder.doBuild() method creates the same uppercase mapping:
>   public void doBuild() throws TorqueException {
> ...
>     dbMap.addTable("address");
>     TableMap tMap = dbMap.getTable("address");
>     tMap.setPrimaryKeyMethod("none");
>     tMap.addPrimaryKey("address.CLASS", "" );
>     tMap.addPrimaryKey("address.ID", "" );
>     tMap.addPrimaryKey("address.POSITION", new Integer(0) );
>     tMap.addColumn("address.NAME1", "", 50 );
>     tMap.addColumn("address.NAME2", "", 50 );
>     tMap.addColumn("address.NAME3", "", 50 );
>     tMap.addColumn("address.STREET", "", 50 );
>     tMap.addColumn("address.ZIPCODE", "", 25 );
>     tMap.addColumn("address.CITY", "", 60 );
>     tMap.addColumn("address.PHONE", "", 40 );
>     tMap.addColumn("address.PHONE2", "", 40 );
>     tMap.addColumn("address.COUNTRY", "", 200 );
>     tMap.addColumn("address.STATE", "", 200 );
>     tMap.addColumn("address.FAX", "", 40 );
>     tMap.addColumn("address.EMAIL", "", 150 );
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
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