Since ORMLite is already mapping an Android Cursor to a POJO. I'm wondering if I could somehow leverage that instead of writing a copy constructor and manually map a Cursor to my POJO?
I could for example, use a content provider and map that result into the same POJO's backed by ORMLite's Dao. Perform operations on my dataset and then batch insert that data into my database using ORMLite. The advantage to this would be that I don't have to write all the CRUD ofc.
EDIT:
this is a fabricated example but the concept is here. What would be the best way to do something like this?
@DatabaseTable(tableName = "my_dict")
public class MyDictionary{
@DatabaseField(columnName = COLUMN_ID, generatedId = true)
Integer _ID;
@DatabaseField(columnName = "word")
String word;
@DatabaseField(columnName = "app_id")
String app_id;
@DatabaseField(columnName = "frequency")
Integer frequency;
@DatabaseField(columnName = "locale")
String locale;
public MyDictionary(){}
}
public void someCoolDatasetOperation(){
Dao<MyDictionary, Long> dao = databaseHelper.getDao(MyDictionary.class);
List<MyDictionary> inDb = dao.queryForAll();
Cursor dictCursor = getContentResolver().query(WEB_SERVICE_URI,
null, // The columns to return for each row
null, // Selection criteria
null, // Selection criteria
null); // The sort order for the returned rows
//iffy part don't know the correct/best way to do this?????
AndroidDatabaseResults fabricatedResult = new AndroidDatabaseResults(dictCursor, null);
List<MyDictionary> fromContentProvider = dao.mapSelectStarRow(dictCursor);
//Do Something with the lists
}