#398 - ENH: Support delete using a Query instance

This commit is contained in:
Robin Bygrave committed 2015-08-29 00:58:47 +12:00
1 parent ccba5d08ef
commit 1c23720605
21 files changed
+407 -24

No files matched your search

@@ -413,6 +413,17 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
detail.convertManyFetchJoinsToQueryJoins(beanDescriptor, lazyLoadManyPath, allowOne, queryBatch);
}
/**
* Setup to be a delete query.
*/
public void setDelete() {
// unset any paging and select on the id in the case where the query
// includes joins and we use - delete ... where id in (...)
maxRows = 0;
firstRow = 0;
setSelectId();
}
/**
* Set the select clause to select the Id property.
*/
@@ -948,6 +959,11 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
return this;
}
@Override
public int delete() {
return server.delete(this, null);
}
public List<Object> findIds() {
// a copy of this query is made in the server
// as the query needs to modified (so we modify