db-ojb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Villegas <...@uniscope.jp>
Subject deleteByQuery and relationships
Date Wed, 29 Dec 2004 09:15:51 GMT
Hi,

Let's say I have reference on table A to a table B and I want to delete 
the A rows for which the related B instances match some criteria. Let's 
say my reference field is 'b'. The nice way to do it (if it worked) 
would be:

criteria.addEqualTo("b.type", "foo");
query = new QueryByCriteria(A.class, criteria);
broker.deleteByQuery(query);

However, this doesn't work. I get the following SQL:

DELETE FROM A WHERE type='foo'

where I was expecting something like

DELETE FROM A WHERE A.bid = B.id AND B.type='foo'

in case of PostgreSQL but the syntax will depend on the database.


Should this work? Or is there any reason why this is not supported or 
not working now?

Carlos

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


Mime
View raw message