Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class BaseModel extends Model {
- public static final String _RID = "remote_id";
- public int getRemoteId() {
- return -1;
- }
- //Isso é usado para limpar o banco, truncate. Class<? extends Model> é uma classe que extende model.
- public static void truncate(Class<? extends Model> type) {
- try {
- TableInfo tableInfo = Cache.getTableInfo(type);
- ActiveAndroid.execSQL("delete from " + tableInfo.getTableName() + ";");
- ActiveAndroid.execSQL("delete from sqlite_sequence where name='" + tableInfo.getTableName() + "';");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment