Re: Re: persistent.delete() ?

Michael Nash <[email protected]> Wed, 25 Aug 2004 13:02:06 -0400
Newsgroups gmane.comp.java.keel.user
Organization JGlobal Limited
Message-ID <[email protected]>
Nathan:

You're quite right - it was in the Persistent implementations, but not
the interface! I've added it & checked it in, this is too handy a
feature to be without :-)

Mike

On Wed, 2004-08-25 at 13:09, Nathan Kontny wrote:
> The last time I checked though, setCustomWhere clause is not available in the
> interface of a Persistent.....
> 
> Quoting Michael Nash <[email protected]>:
> 
> > Vince:
> > 
> > Custom where clause should do the job! Just use
> > setCustomWhereClause(String) before calling delete...
> > 
> > Mike
> > 
> > On Tue, 2004-08-24 at 15:03, Vince Bono wrote:
> > > Steve, Mike,
> > > 
> > > I see some "customWhereClause" code in
> > >
> > svc-persist-default/src/java/org/keel/services/persist/defaultpersist/Defaul
> > > tPersistent.java
> > > 
> > >         sqlCommand.append("DELETE FROM ");
> > >         sqlCommand.append(myMetaData.getTableName());
> > >         if (customWhereClause != null) {
> > >             sqlCommand.append(customWhereClause);
> > >         } else {
> > >             sqlCommand.append(buildWhereClauseBuffer(false));
> > >         }
> > > 
> > > 
> > > 
> > > Or would using svc-query-jdbc  be the better solution ?
> > > 
> > > 
> > > Vince
> > > 
> > > 
> > > 
> > > "Stephen Davidson" <[email protected]> wrote in
> > > message news:[email protected]
> > > > Hi Mike.
> > > >
> > > > I do object to the Database overhead that your suggestion would entail.
> > > >
> > > > Vince, if you send me a patch, I will be happy to apply it (after some
> > > > general testing, and making sure it does not break any Unit tests, of
> > > > course).  Or, if you want to open a Feature Request on SourceForge and
> > > > assign it to me, I will tackle it when I get a few minutes (probably
> > > > later this week).
> > > >
> > > > Regards,
> > > > Steve
> > > >
> > > > Michael Nash wrote:
> > > >
> > > > >Vince:
> > > > >
> > > > >delete is key-based, not criteria-based, so the only way (I can think
> > > > >of) to do what you want would be as follows:
> > > > >
> > > > >p.setField("id1", id1);
> > > > >p.retrieve();
> > > > >p.delete()
> > > > >
> > > > >then
> > > > >
> > > > >p.setField("id2", id2)
> > > > >p.retrieve()
> > > > >p.delete
> > > > >
> > > > >Of course you can do this in a loop, if there are lots of ids you want
> > > > >to delete...
> > > > >
> > > > >Mike
> > > > >
> > > > >On Mon, 2004-08-23 at 10:02, Vince Bono wrote:
> > > > >
> > > > >
> > > > >>I have a question with persists.delete()
> > > > >>I have a table - myTable
> > > > >>id1, id2, field1, field2 ... fieldn
> > > > >>
> > > > >>The  id fields are not unique.
> > > > >>I want to delete all rows where   id1=val1 and id2=val2
> > > > >>if I set
> > > > >>p.setField("id1", id1);
> > > > >>p.setField("id2", id2);
> > > > >>p.delete();       // will generate the command      DELETE FROM
> > myTable;
> > > > >>and delete all records
> > > > >>p.deleteAll();    //  will not generate any  "DELETE" command
> > > > >>
> > > > >>prefixing with p.query()  doesnt appear to work either
> > > > >>any suggestions ?
> > > > >>
> > > > >>Thanks,
> > > > >>
> > > > >>
> > > > >
> > > > >_______________________________________________
> > > > >User mailing list
> > > > >[email protected]
> > > > >http://lists.keelframework.org/listinfo.cgi/user-keelframework.org
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > -- 
> > > > Java/J2EE Developer/Integrator
> > > > Stephen Davidson and Associates, Inc.
> > > > Chair, Dallas/FortWorth J2EE Sig
> > > > 214-724-7741
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > User mailing list
> > > [email protected]
> > > http://lists.keelframework.org/listinfo.cgi/user-keelframework.org
> > 
> > _______________________________________________
> > User mailing list
> > [email protected]
> > http://lists.keelframework.org/listinfo.cgi/user-keelframework.org
> > 
> 
> 
> _______________________________________________
> User mailing list
> [email protected]
> http://lists.keelframework.org/listinfo.cgi/user-keelframework.org