Introduction to the Speaker • Rails Engineer at Bit Jouryney, Inc. • Released Kibela (kibe.la) recently • Mobile Application Engineer at Speee, Inc. • As a Technical Advisor • Loves Programming, Cooking and Gaming
Why You Stores Data to Local • To identify the device and its preferences • Much faster than Web API -> cache • Much more reliable than Web API -> offline-first development
Data Storage on Android • Built-in SharedPreferences • Built-in File with the filesystem • Built-in SQLiteDatabase (SQLite) • SQLite wrappers (ORMs) • Original DB (Realm, ObjectBox, etc.)
Data Storage on Android • Built-in SharedPreferences • Built-in File with the filesystem • Built-in SQLiteDatabase (SQLite) • SQLite wrappers (ORMs) • Original DB (Realm, ObjectBox, etc.)
Migration • How schema changes apply to the database • Calling ALTER TABLE, or completely re- create tables if needed • SQLiteOpenHelper’s / Java code / Automatic
What to See A. How O/R Mapping Is B. The Interface of Query Builder C. Association Support D. Pub-Sub Support E. Migration F. Performance G. As Open Source Software
ActiveAndroid • One of the most famous ORM in Android • Considered as easy to use • No longer maintained • Baseline for many of ORMs • Based on reflection
greenDAO • One of the most famous ORM in Android • Considered as high performance • Modeling was considered terrible • Based on gradle-plugin-based code generator
As Open Source Software • Last commit: 2017/03 • Last stable release: 2016/10 • @greenbot is developing another ORM: • ObjectBox, a brand-new mobile database with source-code compatibility with greenDAO
Pros. and Cons. • Users do not use generated classes, and thus the interface is not type safe • Full-time comitters are awesome • Migration is terrible • Query builder is not type safe
Query Builder • Todo_Selector (generated class) • Todo_Selector#idEq(long) • only for indexed columns • Todo_Selector#orderByIdDesc() • only for indexed columns