db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bouvet Konsulent" <bouvetk...@statnett.no>
Subject Orcale, Criteria and Date
Date Tue, 19 Apr 2005 08:22:53 GMT
hello list,
I have been given the task to move an existing application using Torque 3.1 from Postgres
to Oracle. I am new to Torque, so I am sorry if this question is insulting anyone ;-) 
I have re-generated the databases with "torque.databse=oracle" in the build.properties-file,
the jdbc-connection is working fine etc.

I am running the following code:

Criteria crit = new Criteria();
crit.add(DocumentPeer.IS_DELETED, 1);
Object  o = (new Date(System.currentTimeMillis() - keeptime).toString());
//Object  o = sdf.format(new Date(System.currentTimeMillis() - keeptime));
crit.add(DocumentPeer.CHANGED, o, Criteria.LESS_THAN);
log("Criteria="+crit+", o="+o+", keeptime="+keeptime);

which generates the following output:

2005-04-19 10:08:14,258 INFO  [org.jboss.web.localhost.Engine] StandardContext[/mywebapp]Criteria=Criteria::
document.CHANGED<=>document.CHANGED<'18.02.2005 09:08:14':  document.IS_DELETED<=>document.IS_DELETED=1:
Current Query SQL (may not be complete or applicable): SELECT  FROM document WHERE document.CHANGED<'18.02.2005
09:08:14' AND document.IS_DELETED=1, o=18.02.2005 09:08:14, keeptime=5184000000
2005-04-19 10:08:14,265 ERROR [org.jboss.web.localhost.Engine] StandardContext[/mywebapp]IndexWorkerServlet:WorkerThread:updateFiles()
:Unable to delete files
java.sql.SQLException: ORA-01830: date format picture ends before converting entire input

I understand that Oracle does not like the date-format here, and if I were to run directly
towards an Oracle database, I would use the TO_DATE function like this:
TO_DATE('18.04.2005 09:08:14','DD.MM.YYYY HH.MI.SS')

However, I am not able to do this here, as I thought Torque would take care of everything
for me!?
I see that Criteria also has an addDate-function, but this does not give me the option of
adding time of day, only day, month and year.

If anyone has a solution, I would highly appreciate it!


Statnett SF, Tel. head office +47 22527000, Enterprise No. NO 962 986 633 VAT, www.statnett.no,

This e-mail and any attached files are confidential and may be legally privileged. If you
have received this transmission in error please notify the sender by reply e-mail immediately
and then delete the e-mail.
E-mail transmission cannot be guaranteed to be secure or error free as information could be
intercepted, corrupted, lost, destroyed, arrive late or incomplete. If verification is required
please request a hard copy version. This e-mail message has been virus checked by the virus
programs used by Statnett SF.

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

View raw message