#666 - deleteAll(beans) return int , but deleteAll(beanType,ids) return void in EbeanServer

This commit is contained in:
Robin Bygrave committed 2016-04-27 08:04:43 +12:00
1 parent ae261d3782
commit f8b5a7f312
6 files changed
+31 -30

No files matched your search

@@ -1793,32 +1793,33 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public void deleteAll(Class<?> beanType, Collection<?> ids) {
deleteAll(beanType, ids, null);
public int deleteAll(Class<?> beanType, Collection<?> ids) {
return deleteAll(beanType, ids, null);
}
@Override
public void deleteAll(Class<?> beanType, Collection<?> ids, Transaction t) {
deleteAll(beanType, ids, t, false);
public int deleteAll(Class<?> beanType, Collection<?> ids, Transaction t) {
return deleteAll(beanType, ids, t, false);
}
@Override
public void deleteAllPermanent(Class<?> beanType, Collection<?> ids) {
deleteAll(beanType, ids, null, true);
public int deleteAllPermanent(Class<?> beanType, Collection<?> ids) {
return deleteAll(beanType, ids, null, true);
}
@Override
public void deleteAllPermanent(Class<?> beanType, Collection<?> ids, Transaction t) {
deleteAll(beanType, ids, t, true);
public int deleteAllPermanent(Class<?> beanType, Collection<?> ids, Transaction t) {
return deleteAll(beanType, ids, t, true);
}
private void deleteAll(Class<?> beanType, Collection<?> ids, Transaction t, boolean permanent) {
private int deleteAll(Class<?> beanType, Collection<?> ids, Transaction t, boolean permanent) {
TransWrapper wrap = initTransIfRequired(t);
try {
SpiTransaction trans = wrap.transaction;
persister.deleteMany(beanType, ids, trans, permanent);
int count = persister.deleteMany(beanType, ids, trans, permanent);
wrap.commitIfCreated();
return count;
} catch (RuntimeException e) {
wrap.rollbackIfCreated();
@@ -71,7 +71,7 @@ public interface Persister {
/**
* Delete multiple beans given a collection of Id values.
*/
void deleteMany(Class<?> beanType, Collection<?> ids, Transaction transaction, boolean permanent);
int deleteMany(Class<?> beanType, Collection<?> ids, Transaction transaction, boolean permanent);
/**
* Execute the Update.
@@ -565,10 +565,10 @@ public final class DefaultPersister implements Persister {
/**
* Delete by a List of Id's.
*/
public void deleteMany(Class<?> beanType, Collection<?> ids, Transaction transaction, boolean permanent) {
public int deleteMany(Class<?> beanType, Collection<?> ids, Transaction transaction, boolean permanent) {
if (ids == null || ids.size() == 0) {
return;
return 0;
}
BeanDescriptor<?> descriptor = beanDescriptorManager.getBeanDescriptor(beanType);
@@ -580,7 +580,7 @@ public final class DefaultPersister implements Persister {
}
boolean softDelete = !permanent && descriptor.isSoftDelete();
delete(descriptor, null, idList, transaction, softDelete);
return delete(descriptor, null, idList, transaction, softDelete);
}
/**