hi,

here's my sample code which works without quoting strings:

Query query;
Criteria crit;

crit = new Criteria();
crit.addEqualTo("name", "NAME TO DELETE");
query = new QueryByCriteria(Person.class, crit);
broker.deleteByQuery(query);

this results in the following sql:
DEBUG: SQL: DELETE FROM tabPerson WHERE name = ?

jakob

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 9:10 AM
Subject: Re: deleteByQuery


> Hi Jakob,
>
> here is some sample code of my load and delete methods. It's quite easy so
I
> don't understand why OJB reacts differently:
>
> load:
> after construction of a criteria
> protected Collection getCollectionByCriteria(Class c, Criteria criteria)
> throws Exception
> {
>   Query query = QueryFactory.newQuery(c, criteria);
>   return getCollectionByQuery(query);
> }
>
> delete:
> public void delete(Object o) throws Exception
> {
>   try
>   {
>     broker.beginTransaction();
>     Query query = QueryFactory.newQuery(o.getClass(), criteria);
>     broker.deleteByQuery(query);
>     broker.commitTransaction();
>   }
>   catch (Exception ex)
>   {
>     broker.abortTransaction();
>     //some more exception handling
>   }
> }
>
> > hi roger,
> >
> > can you please send some sample code ?
> >
> > jakob
> >
> > ----- Original Message -----
> > From: "Janssen, Roger" <[EMAIL PROTECTED]>
> > To: "'OJB Users List'" <[EMAIL PROTECTED]>
> > Sent: Wednesday, November 13, 2002 4:18 PM
> > Subject: RE: deleteByQuery
> >
> >
> > Yes, i have similar problems!
> >
> > Roger Janssen
> > iBnax
> >
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:SmutjeJim@;gmx.net]
> > Sent: woensdag 13 november 2002 15:36
> > To: [EMAIL PROTECTED]
> > Subject: deleteByQuery
> >
> >
> > Hi out there,
> >
> > I have difficulties using the broker.deleteByQuery method. In contrast
to
> > getCollectionByQuery (when using exactly the same criteria) I need to
> > quote
> > my
> > string values. Otherwise my database (DB2 and HSQLDB) throw errors
because
> > they try to refer to column names and not to string values.
> >
> > Anybody has/had similar problems?
> >
> > Cheers,
> >
> > Christopher Cudennec
> >
> > --
> > +++ GMX - Mail, Messaging & more  http://www.gmx.net +++
> > NEU: Mit GMX ins Internet. Rund um die Uhr f�r 1 ct/ Min. surfen!
> >
> >
> > --
> > To unsubscribe, e-mail:
<mailto:ojb-user-unsubscribe@;jakarta.apache.org>
> > For additional commands, e-mail:
<mailto:ojb-user-help@;jakarta.apache.org>
> >
> >
> >
*************************************************************************
> > The information contained in this communication is confidential and is
> > intended solely for the use of the individual or entity to  whom it is
> > addressed.You should not copy, disclose or distribute this communication
> > without the authority of iBanx bv. iBanx bv is neither liable for
> > the proper and complete transmission of the information has been
> > maintained
> > nor that the communication is free of viruses, interceptions or
> > interference.
> >
> > If you are not the intended recipient of this communication please
return
> > the communication to the sender and delete and destroy all copies.
> >
> > --
> > To unsubscribe, e-mail:
<mailto:ojb-user-unsubscribe@;jakarta.apache.org>
> > For additional commands, e-mail:
<mailto:ojb-user-help@;jakarta.apache.org>
> >
> >
> > --
> > To unsubscribe, e-mail:
<mailto:ojb-user-unsubscribe@;jakarta.apache.org>
> > For additional commands, e-mail:
<mailto:ojb-user-help@;jakarta.apache.org>
> >
>
> --
> +++ GMX - Mail, Messaging & more  http://www.gmx.net +++
> NEU: Mit GMX ins Internet. Rund um die Uhr f�r 1 ct/ Min. surfen!
>
>
> --
> To unsubscribe, e-mail:   <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>

Reply via email to