db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Clotworthy" <tclotwor...@bka-inc.com>
Subject RE: Criteria.addAscendingOrderByColumn() bug? (DB IS NULL)
Date Fri, 11 Jul 2003 16:23:04 GMT
Thanks, just tried that, and it did not fix my problem. I strongly
suspect I simply have a configuration issue that is causing this one
problem. Its causing the null pointer exception to be thrown at this
insidious little line of BasePeer: 
ColumnMap column = dbMap.getTable(table).getColumn(columnName); 

I do indeed initialize from the torque.properties file..

> -----Original Message-----
> From: Mark Lowe [mailto:mark.lowe@talk21.com]
> Sent: Friday, July 11, 2003 7:39 AM
> To: Turbine Torque Users List
> Subject: Re: Criteria.addAscendingOrderByColumn() bug? (DB IS NULL)
> 
> I don't have any problem either...
> 
> Criteria crit = new Criteria();
> crit.addAscendingOrderByColumn(UserPeer.FIRST_NAME);
> List userList = UserPeer.doSelect(crit);
> 
> Also works fine with the other generated static fields, you may get
> some insights by looking at the java docs of your generated code..
> 
> See what fields are inherited in your XXXPeer class from the
> BaseXXXPeer...
> 
> in case it helps my database schema just has...
> 
> <database name="MYDB" package="com.mypackage.torque">
> <table name="FOO_USER"  javaName="User">
> 	<column name="FOO_USER_ID" required="true" primaryKey="true"
> autoIncrement="true"  type="INTEGER" javaName="Id"/>
> 	<column name="FIRST_NAME" type="VARCHAR" javaName="FirstName"
> size="255" />
> ...
> </table>
> </database>
> 
> Cheers mark
> 
> On Thursday, July 10, 2003, at 03:12 AM, Koichi Nakagawa wrote:
> 
> > I don't have no problem with using a string column for ordering.
> > I solved this problem checking the following.
> >
> > 1. Check schema.xml file .
> >    (name attribute of database element)
> >
> >    In many case , this attribute is missing.
> >
> >> In my schema file I have the element
> >>     <database name="rego" defaultIdMethod="none">
> >  # Geoff , It's OK.
> >
> > 2. Check Torque.prperties
> >    (torque.database.XXXX.adapter=RDBMS NAME)
> >     XXXX must be your database name.
> >
> >
> >
> > Geoff Fortytwo wrote:
> >> I'm having the problem as well. People have asked about this on
this
> >> list a
> >> number of times, but no one seems to have an answer. The problem
lies
> >> with
> >> using a string column for ordering vs any other column type. Try
> >> ordering
> >> with any other column which is not a string column. I'll bet it
works.
> >>
> >> In the source code of BasePeer, it appears that the "db" variable
is
> >> null.
> >> That variable is only referred to if the order by column is a
string,
> >> so
> >> that's why there's a problem only when using string columns to
order
> >> by.
> >>
> >> The value of db is set higher up in the function with:
> >>         DB db = Torque.getDB(criteria.getDbName());
> >>
> >> So for some reason Torque.getDB is returning null.
> >>
> >> I've tried creating the Criteria using:
> >>     Criteria crit = new Criteria();
> >> or
> >>     Criteria crit = new Criteria("rego");
> >> where "rego" is my database name.
> >>
> >> I've tried calling
> >>         crit.setDbName("rego");
> >>
> >> In my schema file I have the element
> >>     <database name="rego" defaultIdMethod="none">
> >>
> >> But none of those things makes any difference.
> >>
> >> Can anyone help? Does anyone know how to fix this?
> >>
> >>
> >> At 01:50 PM 7/9/2003, Tim Clotworthy wrote:
> >>> Thanks for the reply. Did you ever resolve this, and if so, could
you
> >>> tell me how? I am using Oracle9i database, and torque3.0.  Thanks
> >>> again.
> >>>
> >>>> -----Original Message-----
> >>>> From: Duddikunta, Padmanabha [mailto:Pkd2@cdc.gov]
> >>>> Sent: Wednesday, July 09, 2003 4:32 PM
> >>>> To: 'Turbine Torque Users List'
> >>>> Subject: RE: Criteria.addAscendingOrderByColumn() bug?
> >>>>
> >>>> I have encountered same NullPointerException when ordering by
> >>> ascending as
> >>>> well as descending.
> >>>>
> >>>> Paddy
> >>>>
> >>>>
> >>>> -----Original Message-----
> >>>> From: Tim Clotworthy [mailto:tclotworthy@bka-inc.com]
> >>>> Sent: Wednesday, July 09, 2003 4:22 PM
> >>>> To: Torque-User@Db. Apache. Org
> >>>> Subject: Criteria.addAscendingOrderByColumn() bug?
> >>>>
> >>>> Hello,
> >>>> I was hoping some could tell me whether there are any know bugs
with
> >>> the
> >>>>
> >>>> org.apache.torque.util.Criteria. addAscendingOrderByColumn()
method?
> >>>> I have a very simple query:
> >>>>
> >>>> FESCriteria crit = new FESCriteria();
> >>>>
> >>>
crit.addAscendingOrderByColumn(RefTransactionCodesPeer.TYPE_OF_TRANSA
> >>> CTI
> >>>> ON);
> >>>>
> >>>> transList = (ArrayList) RefTransactionCodesPeer.doSelect(crit);
> >>>>
> >>>> If I leave out the addAscendingOrderByColumn line, it works fine.
> >>>> When
> >>>> included,
> >>>> I get an exception:
> >>>>
> >>>> java.lang.NullPointerException
> >>>>         at
> >>>> org.apache.torque.util.BasePeer.createQuery(BasePeer.java:1209)
> >>>>         at
> >>>>
org.apache.torque.util.BasePeer.createQueryString(BasePeer.java:927)
> >>>>         at
> >>> org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1321)
> >>>>         at
> >>>>
com.hotapp.fes.om.BaseRefTransactionCodesPeer.doSelectVillageRecords
> >>>> (
> >>>> BaseRefTransactionCodesPeer.java:398)
> >>>>         at
> >>>>
com.hotapp.fes.om.BaseRefTransactionCodesPeer.doSelectVillageRecords
> >>>> (
> >>>> BaseRefTransactionCodesPeer.java:366)
> >>>>         at
> >>>>
com.hotapp.fes.om.BaseRefTransactionCodesPeer.doSelect(BaseRefTransa
> >>>> c
> >>>> tionCodesPeer.java:334)
> >>>>         at
> >>>>
com.hotapp.fes.support.FESSupportDAO.selectTransTypes(FESSupportDAO.
> >>>> j
> >>>> ava:202)...blah, blah, blah..
> >>>>
> >>>> I have verified that the
RefTransactionCodesPeer.TYPE_OF_TRANSACTION
> >>> is
> >>>> equivalent to a valid and appropriate String value, so its not
that.
> >>>>
> >>>> Any ideas would be greatly appreciated. Thanks.
> >>>>
> >>>>
> >>>>
> >>>>
--------------------------------------------------------------------
> >>>> -
> >>>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> >>>> For additional commands, e-mail: torque-user-help@db.apache.org
> >>>
> >>>
> >>>
> >>>
---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> >>> For additional commands, e-mail: torque-user-help@db.apache.org
> >>
> >>
> >>
---------------------------------------------------------------------
> >> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> >> For additional commands, e-mail: torque-user-help@db.apache.org
> >>
> >>
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org



---------------------------------------------------------------------
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