diff --git a/src/com/activeandroid/Model.java b/src/com/activeandroid/Model.java index 421426ea3..dc256899a 100644 --- a/src/com/activeandroid/Model.java +++ b/src/com/activeandroid/Model.java @@ -71,7 +71,7 @@ public final void delete() { .notifyChange(ContentProvider.createUri(mTableInfo.getType(), mId), null); } - public final Long save() { + public Long save() { final SQLiteDatabase db = Cache.openDatabase(); final ContentValues values = new ContentValues(); @@ -175,6 +175,14 @@ public static T load(Class type, long id) { return (T) new Select().from(type).where(tableInfo.getIdName()+"=?", id).executeSingle(); } + public static List all(Class type) { + return (List) new Select().from(type).execute(); + } + + public static T first(Class type) { + return (T) new Select().from(type).executeSingle(); + } + // Model population public final void loadFromCursor(Cursor cursor) {