db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jarnot Voytek Contr AU HQ/SC <Voytek.Jar...@MAXWELL.AF.MIL>
Subject RE: Torque 3.0 Oracle 8i and Dates
Date Thu, 13 Feb 2003 21:18:46 GMT
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.

Anyway, I think my solution should work (it works for us, so far).  What is
the process of forwarding this as a suggestion to the Torque developers?
Torque is still being actively maintained, right?

Thanks,
--
Voytek Jarnot
Quidquid latine dictum sit, altum viditur.


> -----Original Message-----
> From: Jarnot Voytek Contr AU HQ/SC 
> [mailto:Voytek.Jarnot@maxwell.af.mil]
> Sent: Thursday, February 13, 2003 12:43 PM
> To: 'Turbine Torque Users List'
> Subject: RE: Torque 3.0 Oracle 8i and Dates
> 
> 
> To further clarify, here's a stack trace:
> 
> java.lang.NullPointerException
>         at
> org.apache.torque.util.SqlExpression.build(SqlExpression.java:278)
>         at
> org.apache.torque.util.SqlExpression.build(SqlExpression.java:205)
>         at 
> org.apache.torque.util.BasePeer.doUpdate(BasePeer.java:1846)
>         at 
> org.apache.torque.util.BasePeer.doUpdate(BasePeer.java:1772)
>         at 
> mypackage.BaseMyEntityPeer.doUpdate(BaseMyEntityPeer.java:430)
>         at 
> mypackage.BaseMyEntityPeer.doUpdate(BaseMyEntityPeer.java:404)
> ... and so it goes ...
> 
> --
> Voytek Jarnot
> Quidquid latine dictum sit, altum viditur.
> 
> 
> > -----Original Message-----
> > From: Jarnot Voytek Contr AU HQ/SC 
> > [mailto:Voytek.Jarnot@maxwell.af.mil]
> > Sent: Thursday, February 13, 2003 11:43 AM
> > To: 'torque-user@db.apache.org'
> > Subject: Torque 3.0 Oracle 8i and Dates
> > 
> > 
> > I'm new to the list, so hopefully this isn't a rehash...
> > 
> > I'm running into this bug:
> > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15745 , a 
> lot of our
> > tables include date columns as part of the pk, and I can't 
> > wrap my head
> > around the fact that that would be unsupported.  I would 
> > appreciate any and
> > all help with this issue, as this bug will make torque 
> unusable for us
> > without a work-around.
> > 
> > Are there any work-arounds for this problem (please say yes)?
> > 
> > Thanks,
> > --
> > Voytek Jarnot
> > Quidquid latine dictum sit, altum viditur.
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > 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