Basic SQLite ORM library for Android
Gradle
compile 'ie.mavon.sqlitemodel:sqlitemodel:1.0.0'
Maven
<dependency>
<groupId>ie.mavon.sqlitemodel</groupId>
<artifactId>sqlitemodel</artifactId>
<version>1.0.0</version>
<type>pom</type>
</dependency>
SQLiteModel allows you to make saving/retrieving objects to sqlite very easy:
Employee Class:
public class Employee extends SQLiteModel {
private static Map<String, Integer> dbColumns = null;
private String name;
@Override
public Map<String, Integer> getDbColumns() {
if (dbColumns == null) {
dbColumns = new HashMap<>();
dbColumns.put("name", TYPE_TEXT);
SQLiteModel.setDBColumns(dbColumns);
}
return dbColumns;
}
@Override
protected String getTableName() {
return "employees";
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Employee employee = new Employee();
employee.setName("Joe Blogs";
employee.save(); //Persisted to the db