You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Patrick Tonidandel <pa...@wuerth.it> on 2001/09/05 09:41:27 UTC

Case sensitive DB

Hi there,

I have some troubles with the source code generation.

I have problems with the "Table"MapBuilder.java files generated by Torque.
There are some Databases that have case sensitive behaviour on column names
in select statements.

If I write a application-shema.xml file like :

<database>
  <table name="District" javaName="District" skipSql="true">
    <column name="DistrictID" required="true" primaryKey="true"
type="INTEGER"/>
    <column name="Description" size="50" type="VARCHAR"/>
  </table>
</database>

I get a table District on my Sybase ASE DB with the columns in the right
manner : DistrictID and Description.

But the DistrictMapBuilder.java contains only uppercase column names :

public class DistrictMapBuilder implements MapBuilder
{
    /** the name of this class */
    public static final String CLASS_NAME =
"com.wuerth.phoenix.speedyadm.om.map.DistrictMapBuilder";

    /** item */
    public static String getTable( )
    {
        return "DISTRICT";
    }


    /** DISTRICT.DISTRICTID */
    public static String getDistrict_Districtid()
    {
        return getTable() + ".DISTRICTID";
    }

    /** DISTRICT.DESCRIPTION */
    public static String getDistrict_Description()
    {
        return getTable() + ".DESCRIPTION";
    }

    /**  the database map  */
    private DatabaseMap dbMap = null;

    /**
        tells us if this DatabaseMapBuilder is built so that we don't have
        to re-build it every time
    */
    public boolean isBuilt()
    {
        if ( dbMap != null )
            return true;
        return false;
    }

    /**  gets the databasemap this map builder built.  */
    public DatabaseMap getDatabaseMap()
    {
        return this.dbMap;
    }
    /** the doBuild() method builds the DatabaseMap */
    public void doBuild ( ) throws Exception
    {
        dbMap = TurbineDB.getDatabaseMap("default");

        dbMap.addTable(getTable());
        TableMap tMap = dbMap.getTable(getTable());

        tMap.setPrimaryKeyMethod(TableMap.NONE);



                  tMap.addPrimaryKey ( getDistrict_Districtid(), new
Integer(0) );

                  tMap.addColumn ( getDistrict_Description(), new
String() );

    }

}

In this way I cannot acces my case sensitive DB.

Somebody adviced me to change the uppercase-methods in the Mapbuilder.vm
etc. files.
Is this the right solution. Have I got to change all the uppercase-methods
in all files (Peer.vm , Object.vm ,
MultiExtendObject.vm) ?

Till now I changed the Mapbuilder.vm file and it seems to work.

But I have a strange error. I cannot visualize the value of a
PrimaryKey-column.

Any help is very appreciated.

Regards
Patrick


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