This was a very simple problem to resolve but I was looking in the wrong
place (i was looking for a bug, but It's not and was my fault)!!! I
started a project with torque 3.1 then upgrade to torque 3.2 and I
didn't rebuilt the project-schema.xml. I was very stupid and did not
validate xml schema, so i miss to write the name attribute in database
node.


With torque 3.1 the schema was:

<database defaultIdMethod="idbroker" >
    <table name="mytable">
        <column name="myid" primaryKey="true" required="true"
type="INTEGER"/>
        <column name="myname" size="255" type="VARCHAR"/>
   ......
   .....

With torque 3.2 the name attribute is mandatory so the schema is:

<database defaultIdMethod="idbroker" name="mydatabasename" >
    <table name="mytable">
        <column name="myid" primaryKey="true" required="true"
type="INTEGER"/>
        <column name="myname" size="255" type="VARCHAR"/>
   ......
   .....

If you miss the attribute name in all the TableMap file autogenerated by
Torque the database name is "default" and seem to works great except
order by method of Criteria object.

The problem is solved!

Bye!


Il giorno gio, 14/09/2006 alle 17.29 +0200, Luca Ciocci ha scritto:
> Hello,
> I use Torque 3.2 in a large web project (I'm not new to Torque 3.x), and
> I have some trouble ordering result with addAscendingOrderByColumn (or
> addDescendingOrderByColumn) of Criteria object. I've got an exception
> like this:
> 
> java.lang.NullPointerException
>       at org.apache.torque.util.SQLBuilder.processOrderBy(SQLBuilder.java:506)
>       at 
> org.apache.torque.util.SQLBuilder.buildQueryClause(SQLBuilder.java:314)
>       at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:676)
>       at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:725)
>       ...
> 
> This error happens ONLY when in order by method put a varchar column, if
> I use (for example) a integer it works perfectly.
> 
> My project use Tomcat 5.5.9 + MySQL 4.1 and JDBC MySQL Connector3.0.16
> (I've tried also the newer version, but the problem persists).
> 
> Can anyone help me?
> 
> Thanks, Luca.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
-- 
ASK Web Division
Ing. Luca Ciocci
mailto: [EMAIL PROTECTED]
Tel. +39 059 271417


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to