db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dressler,Erik(externe MA)" <Erik.Dress...@Dresdner-Bank.lu>
Subject RE: Problem with doDelete
Date Tue, 07 Jun 2005 07:24:02 GMT

i can't believe that your old criteria works well with doSelect!!! i had the
same problem... ^^

are you able to debug your code and inspect your criteria??? it would be
very interesting for me!

i think, you must get problems using the add-method on the same column!

greets, erik

> -----Original Message-----
> From:	Kalyani Kale [SMTP:kalyani@ascindia.com]
> Sent:	07 June 2005 06:55
> To:	Apache Torque Users List
> Subject:	RE: Problem with doDelete
> 
> Thank you for your reply. but this code also deletes all the records
> that are greater than d1 and does not consider d2 at all. The strange
> part is the same criteria works very well for doSelect but not for
> doDelete. So it looks like the implementation of doDelete is doing
> something wrong.
> 
> Anyway, right now as a work-around, I'm just doing a doSelect using the
> criteria and then I loop through the list and delete each record using
> its primary key.
> 
> Thanx,
> Kalyani
> 
> -----Original Message-----
> From: guy galil [mailto:guy_galil@guardium.com] 
> Sent: Monday, June 06, 2005 10:26 AM
> To: Apache Torque Users List
> Subject: Re: Problem with doDelete
> 
> The way to use the same column twice in one statement
> is as follows:
> Criteria c = new Criteria();
> c.add(Time.EDATE, d1, Criteria.GREATER_EQUAL);
> Criteria.Criterion criterion =
> c.getCriterion(Time.EDATE);
> criterion.and(
>    c.getNewCriterion(
>                 criterion.getTable(),
>                 criterion.getColumn(),
>                  d2,
>                  Criteria.LESS_EQUAL )
>                  );
>      Time.doDelete(c, conn);
> 	
> --- Kalyani Kale <kalyani@ascindia.com> wrote:
> > Hi,
> > 
> > I have a problem with doDelete of torque. This is a
> > sample piece of my
> > code.
> > 
> >  
> > 
> > conn = Transaction.beginOptional( "db", true );
> > 
> >  
> > 
> > DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
> > 
> > Date d1 = df.parse("05/15/2005");
> > 
> > Date d2 = df.parse("05/21/2005");
> > 
> >                                     
> > 
> > Criteria c = new Criteria();
> > 
> > c.add(Time.LOGINID, getLoginID());                  
> >               
> > 
> > c.add(Time.EDATE, d1, Criteria.GREATER_EQUAL);
> > 
> > c.add(Time.EDATE, d2, Criteria.LESS_EQUAL);
> > 
> >                                     
> > 
> > Time.doDelete(c, conn);
> > 
> >  
> > 
> > Transaction.commit( conn );
> > 
> >  
> > 
> > Now, ideally this should delete the records of Time
> > table having EDate
> > between 15th May 2005 and 22nd May 2005.
> > 
> > But it does not consider date d2 at all and deletes
> > all the records that
> > are greater than d1.
> > 
> >  
> > 
> > What could be the problem?
> > 
> >  
> > 
> > Thanx,
> > 
> > Kalyani
> > 
> >  
> > 
> > 
> 
> ---------------------------------------------------------------------
> 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
 
*  *  *  *  *  *  D I S C L A I M E R  *  *  *  *  *  *  *
 
This message is confidential and intended for the named addressee(s) only.
If you are not the intended recipient, please contact the sender by E-Mail
return and then delete this message from your system. You should not copy
or use it or disclose its contents to any other person.
 
If any part of this message is illegible or if you suspect that the message
may have been intercepted or amended, please contact the sender.
Dresdner Bank Luxembourg S.A. cannot accept any responsibility for the
accuracy or completeness of this message without further investigation.
 


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


Mime
View raw message