#216 - ENH: Add Model.Finder deleteById(id) method

This commit is contained in:
rbygrave committed 2014-12-01 23:02:58 +13:00
1 parent 09f8967459
commit dd30b43d59
3 files changed
+38 -5

No files matched your search

+6 -4
View File
@@ -248,10 +248,12 @@ public abstract class Model {
return new Finder<I, T>(server, idType, type);
}
// Does not exist yet but I think should
// public void deleteById(I id) {
// return db().deleteById(type, id);
// }
/**
* Delete a bean by Id.
*/
public void deleteById(I id) {
db().delete(type, id);
}
/**
* Retrieves all entities of the given type.
@@ -455,7 +455,11 @@ public final class DefaultPersister implements Persister {
// delete the bean(s)
SqlUpdate deleteById = descriptor.deleteById(id, idList);
if (t.isLogSummary()) {
t.logSummary("-- Deleting " + descriptor.getName() + " Ids" + idList);
if (idList != null) {
t.logSummary("-- Deleting " + descriptor.getName() + " Ids: " + idList);
} else {
t.logSummary("-- Deleting " + descriptor.getName() + " Id: " + id);
}
}
// use Id's to update L2 cache rather than Bulk table event