Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 43325 invoked from network); 19 Jan 2004 08:26:17 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 19 Jan 2004 08:26:17 -0000 Received: (qmail 89198 invoked by uid 500); 19 Jan 2004 08:25:52 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 88939 invoked by uid 500); 19 Jan 2004 08:25:50 -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 88926 invoked from network); 19 Jan 2004 08:25:50 -0000 Received: from unknown (HELO webdomino.sorma.com) (217.141.48.251) by daedalus.apache.org with SMTP; 19 Jan 2004 08:25:50 -0000 Subject: Problem with multiple criteria on the same field in delete and update To: "TORQUE_LIST" X-Mailer: Lotus Notes Release 5.0.8 June 18, 2001 Message-ID: From: luca.forni@sorma.com Date: Mon, 19 Jan 2004 09:25:57 +0100 X-MIMETrack: Serialize by Router on Webdomino/GRUPPOSORMA(Release 5.0.8 |June 18, 2001) at 19/01/2004 09.26.03 MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi All, I'm using Torque 3.1 with postgresql and i am experiencing a problem with using multiple criteria on the same field in delete and update: --------------------------------------------------------- table/class A A.field1 A.field2 A.field3 --------------------------------------------------------- Criteria criteria = new Criteria(); criteria.setDbName(A.DATABASE_NAME); Criteria.Criterion field1Equal = criteria.getNewCriterion(A.field1, value1, Criteria.EQUAL); Criteria.Criterion field2Equal = criteria.getNewCriterion(A.field2, value2, Criteria.EQUAL); Criteria.Criterion field1Greater = criteria.getNewCriterion(A.field1, value3, Criteria.GREATER_THAN); criteria.and( field1Greater.or(field1Equal.and(field2Equal)) ); APeer.doDelete(criteria); This snippet produced this wrong sql: DELETE FROM A WHERE (A.FIELD1 > value3) Correct SQL should be: DELETE FROM A WHERE (A.FIELD1 > value3 or (A.FIELD1 = value1 and A.FIELD2 = value2)) Ing. Luca Forni SORMA S.p.a. Corso Vinzaglio, 4 - 10121 TORINO (ITALY) Tel. +39 011 53 33 22 http://www.sorma.com --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org