I created a DocumentMapBuilder (in relation with a table DOCUMENT in my
database).
This classe has a  method :
getDocument_Name
{
    return getTableName ()+".name";
}

I add the TableMap to the databaseMap with:
tMap.addColumn ( getDocument_Name(), string); // like :
addColumn("DOCUMENT.name", string);

In another class, I create the criteria with
...
criteria.addOrderByColumn(DOCUMENT_NAME);
...
and I send this criteria to BasePeer.doSelect(criteria)

But there is an error appering because it couldn't retreive the column map
with "name" but with "DOCUMENT.name"
The code in BasePeer is :

...
        if ( orderBy != null && orderBy.size() > 0)
        {
            // Check for each String/Character column and apply
toUpperCase()
            for (int i=0; i<orderBy.size(); i++)
            {
                String orderByColumn = orderBy.get(i);
                String table =
orderByColumn.substring(0,orderByColumn.indexOf('.') );
                String columnName =
rderByColumn.substring( orderByColumn.indexOf('.')+1 );
                ColumnMap column =
bMap.getTable(table).getColumn( columnName );                     // has
problem in my case
                if (  column.getType() instanceof String )
// null pointer exception here


                    orderByClause.add( db.toUpperCase(orderByColumn) );
                }
                else
                {
                    orderByClause.add(orderByColumn);
                }
            }
        }

in my case, if I change
ColumnMap column = dbMap.getTable(table).getColumn( columnName );
by
ColumnMap column = dbMap.getTable(table).getColumn( orderByColumn );
it is OK.

For info, scrab.tigris.org uses the same method. I don't know how they
resolve this problem.
Is there any thing to change in my code (or in BasePeer code) ?

Regards,
Hervé



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to