You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by kidong <Ki...@public.uni-hamburg.de> on 2001/04/19 21:14:44 UTC

problem with order-by

hello,

i have problem with order-by function with criteria.
my first database connection to retrieve all rows is so:

Criteria crit2 = new Criteria();
Vector v2 = org.apache.turbine.ProjektePeer.doSelect( crit2 );

connection null!

i have tried again with this code:


Criteria crit2 = new Criteria();
Vector v2 = org.apache.turbine.ProjektePeer.doSelect( crit2,
GetDBConnection.getAnotherDBConnection()  );

it runs fine.

and now,

Criteria crit2 = new Criteria();
crit2.addOrderByColumn( ProjektePeer.NAME );
Vector v2 = org.apache.turbine.ProjektePeer.doSelect( crit2,
GetDBConnection.getAnotherDBConnection()  );

, where GetDBConnection class is following:

=================================================================
package de.silverscreen.turbine.bugtracker.util;

import java.lang.*;
import org.apache.turbine.util.db.pool.ConnectionPool;
import org.apache.turbine.util.db.pool.DBConnection;

/**
 *  the small database connections are made.
 *  When necessary, static final string could be modified.
 */

public class GetDBConnection
{

   public static final String DRIVER = "org.gjt.mm.mysql.Driver";


   public static final String URL =
"jdbc:mysql://127.0.0.1/bugtracker?user=root";
   public static final String ANOTHER_URL =
"jdbc:mysql://127.0.0.1/zef?user=root";
   public static final String USER = "root";
   public static final String PASSWORD = "";

   /*
   public static final String URL =
"jdbc:mysql://62.157.88.3:3306/bugtracker?user=silver";
   public static final String ANOTHER_URL =
"jdbc:mysql://62.157.88.3:3306/zef?user=silver";
   public static final String USER = "silver";
   public static final String PASSWORD = "tmfitsxy";
   */

   public static DBConnection getDBConnection() throws Exception
   {
      ConnectionPool cp = new ConnectionPool ( DRIVER, URL, USER,
PASSWORD );
      return cp.getConnection();
   }
   public static ConnectionPool getConnectionPool() throws Exception
   {
      return new ConnectionPool ( DRIVER, URL, USER, PASSWORD );
   }

   public static DBConnection getAnotherDBConnection() throws Exception
   {
      ConnectionPool cp = new ConnectionPool ( DRIVER, ANOTHER_URL, USER,
PASSWORD );
      return cp.getConnection();
   }
}
========================================================================

i got the following exception:

[Thu Apr 19 21:06:49 GMT+02:00 2001] -- INFO -- IDBroker thread was started.
[Thu Apr 19 21:06:49 GMT+02:00 2001] -- ERROR -- Turbine.handleException:
null
[Thu Apr 19 21:06:49 GMT+02:00 2001] -- ERROR --
 Exception:  java.lang.NullPointerException
 Stack Trace follows:
 java.lang.NullPointerException
 at
org.apache.turbine.om.peer.BasePeer.createQueryString(BasePeer.java:1004)
 at org.apache.turbine.om.peer.BasePeer.doSelect(BasePeer.java:1114)
 at
org.apache.turbine.BaseProjektePeer.doSelectVillageRecords(BaseProjektePeer.
java:187)
 at org.apache.turbine.BaseProjektePeer.doSelect(BaseProjektePeer.java:148)
 at
de.silverscreen.turbine.bugtracker.modules.screens.Index.doPerformThis(Index
.java:29)
 at
de.silverscreen.turbine.bugtracker.modules.screens.Index.doBuildTemplate(Ind
ex.java:18)
 at
org.apache.turbine.modules.screens.VelocityScreen.doBuildTemplate(VelocitySc
reen.java:115)
 at
org.apache.turbine.modules.screens.TemplateScreen.doBuild(TemplateScreen.jav
a:135)

any idea would be very thankful to me.

thanks,

kidong








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