Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 32817 invoked from network); 8 May 2009 12:58:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 May 2009 12:58:31 -0000 Received: (qmail 97915 invoked by uid 500); 8 May 2009 12:58:30 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 97887 invoked by uid 500); 8 May 2009 12:58:30 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: 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 97877 invoked by uid 99); 8 May 2009 12:58:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 May 2009 12:58:30 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of greg.monroe@dukece.com designates 67.202.195.198 as permitted sender) Received: from [67.202.195.198] (HELO dukece.com) (67.202.195.198) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 May 2009 12:58:19 +0000 Received: from ([10.123.20.180]) by smtpgw2.dukece.com with ESMTP with TLS id 4440156.436853; Fri, 08 May 2009 08:57:41 -0400 Received: from durham-e2k7mb1.dukece.com ([10.123.20.181]) by durham-e2k7ca1.dukece.com ([10.123.20.180]) with mapi; Fri, 8 May 2009 08:57:41 -0400 From: Greg Monroe To: 'Apache Torque Users List' Date: Fri, 8 May 2009 08:57:41 -0400 Subject: RE: multiple criteria on the same field Thread-Topic: multiple criteria on the same field Thread-Index: AcnPwrxeSv7/CHWuRW2oRzT7zKGIGQAGYCcg Message-ID: <55B8568AFA5F144F886F18186BAD5B2C056D7EDC5A@durham-e2k7mb1.dukece.com> References: <4A03E2BB.2060104@archicoop.it> <4A0400C9.8020201@reea.net> In-Reply-To: <4A0400C9.8020201@reea.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Virus-Checked: Checked by ClamAV on apache.org For more information see the documentation at:=0D=0A=0D=0Ahttp://db=2Eapach= e=2Eorg/torque/releases/torque-3=2E3/runtime/reference/read-from-db=2Ehtml#= AND_and_OR_operators=0D=0A=0D=0A=0D=0A> -----Original Message-----=0D=0A> F= rom: Andras Balogh [mailto:andras@reea=2Enet]=0D=0A> Sent: Friday, May 08, = 2009 5:52 AM=0D=0A> To: Apache Torque Users List=0D=0A> Subject: Re: multip= le criteria on the same field=0D=0A> =0D=0A> Hi,=0D=0A> =0D=0A> You need to= do something like:=0D=0A> =0D=0A> criteria=2Eadd( dataIscrizioneInizio=2Ea= nd(dataIscrizioneFine) ) ;=0D=0A> =0D=0A> to add both Criterions in the sa= me time to the Criteria=2E=0D=0A> =0D=0A> Best regards,=0D=0A> Andras=0D=0A= > =0D=0A> =0D=0A> Ivano Luberti wrote:=0D=0A> > Hello , I have searched the= ml and googled for this=2E=0D=0A> > I have found 2 old email asking for th= is but with no answer=2E=0D=0A> >=0D=0A> > When I try to do this :=0D=0A> >= =0D=0A> > Criteria criteria =3D new Criteria();=0D=0A> > Criterion dataIscr= izioneInizio =3D=0D=0A> > criteria=2EgetNewCriterion(IscrizioniSocioPeer=2E= TABLE_NAME, "starttime",=0D=0A> > (Date) (formUser=2EgetDataIscrizioneInizi= o()), Criteria=2EGREATER_EQUAL);=0D=0A> >=0D=0A> >=0D=0A> > dataIscrizioneI= nizio=2EsetIgnoreCase(true);=0D=0A> >=0D=0A> > criteria=2Eadd(dataIscrizion= eInizio);=0D=0A> >=0D=0A> > Criterion dataIscrizioneFine =3D=0D=0A> > crite= ria=2EgetNewCriterion(IscrizioniSocioPeer=2ETABLE_NAME, "starttime",=0D=0A>= > (Date) (formUser=2EgetDataIscrizioneFine()), Criteria=2ELESS_EQUAL);=0D= =0A> >=0D=0A> > dataIscrizioneFine=2EsetIgnoreCase(true);=0D=0A> >=0D=0A> >= criteria=2Eadd(dataIscrizioneFine);=0D=0A> >=0D=0A> > Only the last criter= ion is included in the where clause=2E=0D=0A> >=0D=0A> > I have stepped int= o the add(Criterion) method of the Criteria class and=0D=0A> > found this:= =0D=0A> >=0D=0A> > public Criteria add(Criterion c)=0D=0A> > {=0D= =0A> > StringBuffer sb =3D new StringBuffer(c=2EgetTable()=2Elength= ()=0D=0A> > + c=2EgetColumn()=2Elength() + 1);=0D=0A> > = sb=2Eappend(c=2EgetTable());=0D=0A> > sb=2Eappend('=2E');=0D= =0A> > sb=2Eappend(c=2EgetColumn());=0D=0A> > super=2Eput(s= b=2EtoString(), c);=0D=0A> > return this;=0D=0A> > }=0D=0A> >= =0D=0A> > If I understand well , the map keys are based on the table and fi= eld=0D=0A> > names then it is not possible to add two criteria on the same = field to=0D=0A> > produce sql like:=0D=0A> >=0D=0A> > SELECT * FROM table W= HERE table=2Efield>x AND table=2Efield >=0D=0A> > Can someone sugg= est the best practice to do this with Torque ?=0D=0A> >=0D=0A> >=0D=0A> >= =0D=0A> =0D=0A> =0D=0A> ---------------------------------------------------= ------------------=0D=0A> To unsubscribe, e-mail: torque-user-unsubscribe@d= b=2Eapache=2Eorg=0D=0A> For additional commands, e-mail: torque-user-help@d= b=2Eapache=2Eorg=0D=0A> =0D=0A=0D=0ADukeCE Privacy Statement:=0D=0APlease b= e advised that this e-mail and any files transmitted with=0Ait are confiden= tial communication or may otherwise be privileged or=0Aconfidential and are= intended solely for the individual or entity=0Ato whom they are addressed= =2E If you are not the intended recipient=0Ayou may not rely on the content= s of this email or any attachments,=0Aand we ask that you please not read, = copy or retransmit this=0Acommunication, but reply to the sender and destro= y the email, its=0Acontents, and all copies thereof immediately=2E Any unau= thorized=0Adissemination, distribution or copying of this communication is= =0Astrictly prohibited=2E --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org