mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-09 08:42:18 +00:00
#216 - ENH: Add Model.Finder deleteById(id) method
This commit is contained in:
1 parent
09f8967459
commit
dd30b43d59
3 files changed
+38
-5
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user