mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
#666 - deleteAll(beans) return int , but deleteAll(beanType,ids) return void in EbeanServer
This commit is contained in:
1 parent
ae261d3782
commit
f8b5a7f312
6 files changed
+31
-30
No files matched your search
@@ -738,15 +738,15 @@ public final class Ebean {
|
||||
/**
|
||||
* Delete several beans given their type and id values.
|
||||
*/
|
||||
public static void deleteAll(Class<?> beanType, Collection<?> ids) {
|
||||
serverMgr.getDefaultServer().deleteAll(beanType, ids);
|
||||
public static int deleteAll(Class<?> beanType, Collection<?> ids) {
|
||||
return serverMgr.getDefaultServer().deleteAll(beanType, ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete permanent several beans given their type and id values.
|
||||
*/
|
||||
public static void deleteAllPermanent(Class<?> beanType, Collection<?> ids) {
|
||||
serverMgr.getDefaultServer().deleteAllPermanent(beanType, ids);
|
||||
public static int deleteAllPermanent(Class<?> beanType, Collection<?> ids) {
|
||||
return serverMgr.getDefaultServer().deleteAllPermanent(beanType, ids);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1373,22 +1373,22 @@ public interface EbeanServer {
|
||||
/**
|
||||
* Delete several beans given their type and id values.
|
||||
*/
|
||||
void deleteAll(Class<?> beanType, Collection<?> ids);
|
||||
int deleteAll(Class<?> beanType, Collection<?> ids);
|
||||
|
||||
/**
|
||||
* Delete several beans given their type and id values with an explicit transaction.
|
||||
*/
|
||||
void deleteAll(Class<?> beanType, Collection<?> ids, Transaction transaction);
|
||||
int deleteAll(Class<?> beanType, Collection<?> ids, Transaction transaction);
|
||||
|
||||
/**
|
||||
* Delete permanent for several beans given their type and id values.
|
||||
*/
|
||||
void deleteAllPermanent(Class<?> beanType, Collection<?> ids);
|
||||
int deleteAllPermanent(Class<?> beanType, Collection<?> ids);
|
||||
|
||||
/**
|
||||
* Delete permanent for several beans given their type and id values with an explicit transaction.
|
||||
*/
|
||||
void deleteAllPermanent(Class<?> beanType, Collection<?> ids, Transaction transaction);
|
||||
int deleteAllPermanent(Class<?> beanType, Collection<?> ids, Transaction transaction);
|
||||
|
||||
/**
|
||||
* Execute a Sql Update Delete or Insert statement. This returns the number of
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user