db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brandon Mayes" <eff4...@hotmail.com>
Subject problems with ordering
Date Tue, 08 Mar 2005 15:22:38 GMT
I'm having trouble with ordering columns.  I'm not sure why, I've tried 
debugging, but I always seems to get a null pointer exception, yet I can't 
figure out what's null...maybe it's because I don't have the Torque source 
in the debugger, so I lose my abililty to step through and really see what's 
happening once I leave my generated classes.  But normally I'm getting a 
list back, it's just not sorted.  So I installed p6spy to check the SQL and 
see what was really going on.  So I made this simple little tester class to 
see what's up and I get an exception when I try to order.  I have a DB 
that's a fake doctor's office say, and it holds records of patients.  Any 
idea why the code below wouldn't work, and any suggestions on how to add 
ordering?  According to the Criteria tutorial, my code should work 
perfectly.  All they have is 
"criteria.addAscendingOrderByColumn(RolePeer.NAME);" and I do something very 
similar.  The problem is obviously with the ordering method call.  If I 
comment out that line, the code works and my list prints out...it's just not 
sorted which is what I want to do.  Thanks!  -Brandon



public class Tester
{
	public static void main(String[] args)
	{
		try
		{
			Torque.init("torque.properties");

			Criteria c = new Criteria();
			c.addAscendingOrderByColumn(PatientPeer.LAST_NAME);
			List li = PatientPeer.doSelect(c);
			Iterator i = (Iterator)li.iterator();

			System.out.println("list 1");
			while (i.hasNext())
			{
				Patient p = (Patient)i.next();
				System.out.println(p.toString());
			}
		}
		catch (Exception e)
		{e.printStackTrace();}
	}
}

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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


Mime
View raw message