You should try to change the mapping of DATE type in
/templates/base/oracle/db.props in your generator configuration (I think
you will have to regenerate your om classes).
Change DATE = DATE to DATE = TIMESTAMP
Hope this will work for you
"Bouvet
Konsulent" Pour : <[email protected]>
<[EMAIL PROTECTED] cc :
atnett.no> Objet : Orcale, Criteria and
Date
19/04/2005
10:22
Veuillez
r�pondre �
"Apache Torque
Users List"
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);
DocumentPeer.doDelete(crit);
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 string
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!
/pj
Statnett SF, Tel. head office +47 22527000, Enterprise No. NO 962 986 633
VAT, www.statnett.no, [EMAIL PROTECTED]
_________________________________________________________________
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]