Tx!
I've re compiled the torque project inserting this code but it seams is not
used... where i'm wrong???
private static final String DATE_FORMAT = "dd-MM-yyyy HH:mm:ss";
public String getDateString(Date date) {
System.out.println("I'm here!!");
return "TO_DATE('" + new SimpleDateFormat(DATE_FORMAT).format(date) + "',
'DD-MM-YYYY HH24:MI:SS')";
}
When i run the application i don't see any "I' m here!!!!" string....
You talk about a method getDateString(String) ... but that i introduced is
getDateString(Date date)... is it correct???
Thanks for your patience!
> I had the same problem (and fixed it) back in february. I've submitted TWO
> bug reports (along with code that solves the problem), which seem to have
> been ignored...
>
> Here's my message about the fix from february:
>
> [QUOTING MYSELF]
> Well, I'm going to answer myself in the hopes that this helps someone else,
> my null pointer exception was solved by adding
> torque.database.default.adapter=oracle to my torque.properties file.
>
> That brought to light a whole new suite of problems with using Dates in
> Criteria with Oracle. After wading through the source for a while, I've
> fixed the problem by adding the following to
> org.apache.torque.adapter.DBOracle.java:
>
> private static final String DATE_FORMAT = "dd-MM-yyyy HH:mm:ss";
> public String getDateString(Date date) {
> return "TO_DATE('" + new SimpleDateFormat(DATE_FORMAT).format(date) + "',
> 'DD-MM-YYYY HH24:MI:SS')";
> }
>
> Essentially, since DBOracle didn't override getDateString(String), the one
> from DB was being used - which is completely useless as far as Oracle is
> concerned. Actually it's beyond buggy, because it doesn't take into account
> the fact that Timestamp objects cannot represent dates before 01-Jan-1970.
> [/QUOTING MYSELF]
>
> --
> Voytek Jarnot
> Quidquid latine dictum sit, altum viditur.
>
>
> > -----Original Message-----
> > From: salinaale [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, July 16, 2003 10:05 AM
> > To: torque-user
> > Subject: Oracle and query date
> >
> >
> > Hi,
> > i've a big problem:
> > i 'm using torque 3.0.2 and the db is oracle 8.1.7.0.0. In
> > many of my table
> > there are columns of DATE type, but it seems to me that
> > torque is not able to
> > catch this field!!!!
> > When i try to called a doSelect using a criteria like this:
> >
> > crit.add(peer.DATESTART, date,Criteria.EQUAL);
> >
> > date is an object of java.util.Date
> >
> > I've tried also to use :
> > crit.addDate(....)
> >
> > but i get always this error:
> >
> > java.lang.NullPointerException
> > at
> > org.apache.torque.util.SqlExpression.build(SqlExpression.java:278)
> > at
> > org.apache.torque.util.Criteria$Criterion.appendTo(Criteria.java:3410)
> > at
> > org.apache.torque.util.Criteria$Criterion.toString(Criteria.java:3550)
> > at
> > org.apache.torque.util.BasePeer.createQuery(BasePeer.java:1124)
> > at
> > org.apache.torque.util.BasePeer.createQueryString(BasePeer.java:927)
> > at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1360)
> > at
> > com.sinapsi.comunicazioni.torque.BaseNocTempScadenzaPeer.doSel
> > ectVillageRecords(BaseNocTempScadenzaPeer.java:403)
> > at
> > com.sinapsi.comunicazioni.torque.BaseNocTempScadenzaPeer.doSel
> > ectVillageRecords(BaseNocTempScadenzaPeer.java:370)
> > at
> > com.sinapsi.comunicazioni.torque.BaseNocTempScadenzaPeer.doSel
> > ect(BaseNocTempScadenzaPeer.java:339)
> > at
> > com.sinapsi.comunicazioni.torque.NocTempScadenzaPeer.doSelectA
> > ll(NocTempScadenzaPeer.java:38)
> > ......
> > ......
> >
> >
> > Any idea???? If i can't use this feature torque is not usefull for me.
> > Thanks!
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]