Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 84408 invoked from network); 19 Apr 2005 11:00:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Apr 2005 11:00:43 -0000 Received: (qmail 39559 invoked by uid 500); 19 Apr 2005 11:00:41 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 39540 invoked by uid 500); 19 Apr 2005 11:00:40 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 39525 invoked by uid 99); 19 Apr 2005 11:00:40 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from oslex1.statnett.no (HELO oslex1.Statnett.no) (195.18.187.166) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 19 Apr 2005 04:00:39 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: SV: Orcale, Criteria and Date Date: Tue, 19 Apr 2005 13:00:34 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Orcale, Criteria and Date Thread-Index: AcVEvf6c2Ib0ONsMTE2KPxHj4temAgAD5yhw From: "Bouvet Konsulent" To: "Apache Torque Users List" X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N hello again list, just to sum up here: Bernard's solution looked to be the best, but unfort= unately I am working towards version 8.1.7 of Oracle. And TIMESTAMP was n= ot supported before version 9 :-( Thomas' solution with using Criteria.CUSTOM, however, worked just fine :-= ) This is the code I am now using: private static long keeptime =3D 60 * 1000 * 10 ; //Ten minuttes private static SimpleDateFormat sdf =3D new SimpleDateFormat("dd.MM.yyyy = HH:mm:ss"); Object o =3D DocumentPeer.CHANGED + " < " + "TO_DATE('"+sdf.format(new Date(System.currentTimeMillis() - keeptime))= + "','DD.MM.YYYY HH:MI:SS')"; crit.add(DocumentPeer.CHANGED, o, Criteria.CUSTOM); this generates the following SQL: Current Query SQL (may not be complete or applicable): SELECT FROM docum= ent WHERE document.CHANGED < TO_DATE('18.02.2005 11:57:24','DD.MM.YYYY HH= :MI:SS') AND document.IS_DELETED=3D1 Thank you for your help! cheers, pj -----Opprinnelig melding----- Fra: Thomas Fischer [mailto:fischer@seitenbau.net] Sendt: 19. april 2005 10:58 Til: Apache Torque Users List Emne: RE: Orcale, Criteria and Date Hi, I am not sure whether this is exactly the same thing, but there is a related issue in the issue tracker: http://issues.apache.org/scarab/issues/id/TRQS284 you might want to add a comment to that and describe your problem there. Create a login in scarab and request a role as observer in the module Torque>Source to do that. However, this is not yet fixed in CVS. As for a temporary workaround, you might try to use Criteria.CUSTOM (as I= just learned this morning). See http://nagoya.apache.org/eyebrowse/ReadMsg?listName=3Dtorque-dev@db.apach= e.org&msgNo=3D4833 for details. Unfortunately, this means to create DB-dependant code, but I do not see another possibility at the moment :-( Thomas "Bouvet Konsulent" schrieb am 19.04.2005 10:22:5= 3: > 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=3Doracle" in > the build.properties-file, the jdbc-connection is working fine etc. > > I am running the following code: > > Criteria crit =3D new Criteria(); > crit.add(DocumentPeer.IS_DELETED, 1); > Object o =3D (new Date(System.currentTimeMillis() - keeptime).toString= ()); > //Object o =3D sdf.format(new Date(System.currentTimeMillis() - keeptime)); > crit.add(DocumentPeer.CHANGED, o, Criteria.LESS_THAN); > log("Criteria=3D"+crit+", o=3D"+o+", keeptime=3D"+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=3DCriteria:: document. > CHANGED<=3D>document.CHANGED<'18.02.2005 09:08:14': document. > IS_DELETED<=3D>document.IS_DELETED=3D1: > 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=3D1, o=3D18.02.2005 09:08:14, keeptime=3D5184000000 > 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, firmapost@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 > --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org Statnett SF, Tel. head office +47 22527000, Enterprise No. NO 962 986 633= VAT, www.statnett.no, firmapost@statnett.no _________________________________________________________________ This e-mail and any attached files are confidential and may be legally pr= ivileged. If you have received this transmission in error please notify t= he 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 in= formation could be intercepted, corrupted, lost, destroyed, arrive late o= r incomplete. If verification is required please request a hard copy vers= ion. This e-mail message has been virus checked by the virus programs use= d by Statnett SF. --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org