Easy, Developer Friendly and fully customizable ORM for Android Databases works with Data Mapping between models (tables).
Easily manage relation between tables and browse records for ManyToOne, ManyToMany and OneToMany without writing query or making object of related model (table).
Android Gradle:
Android Studio 3.0+
implementation 'com.oogbox.support:mobile-orm:1.0.0'
Older Android Studio
compile 'com.oogbox.support:mobile-orm:1.0.0'
- Auto Database Creation. (No worry for create statements)
- Different data types support; Basic and relation types (ManyToOne, ManyToMany and OneToMany)
- Easy record browsing for relation records
- Content Provider implimentation (Minor setup and all done). Mainly for sync-adapters and services
DataResolver
for better query management with Content Provider- Quick Relation record create support (Directly create ManyToOne, OneToMany or ManyToMany records for main record creation)
- and much more...
Before start to use mobile-orm
you required to set some basic configuration.
Registering Meta in AndroidManifest.xml
You can init MobileORMConfig
with key DATABASE_CONFIG
and path of your class
<application ....>
....
<meta-data android:name="DATABASE_CONFIG"
android:value="com.my.application.db.DatabaseConfig"/>
...
</application>
Here, com.my.application.db.DatabaseConfig
is class with your database configuration which extends MobileORMConfig
class.
public class DatabaseConfig extends MobileORMConfig {
public DatabaseConfig(Context context) {
super(context);
}
@Override
public String getDatabaseName() {
return "MobileORMSample.db";
}
@Override
public String authority() {
return getContext().getString(R.string.db_authority);
}
}
Reason behind making Config class and adding path to meta-data?
Yes, because in some case when you need to create database based on user properties such as, different database for different user. That can be handled from this configuration.
authority()
is optional if you need to use ContentProvider
mechanism.
Changing Database version:
<application ....>
....
<meta-data android:name="DATABASE_VERSION"
android:value="2"/>
...
</application>
That's it. You have configured your MobileORM
.
- Creating Model (Table)
- Register model in configuration
- Data types (Fields)
- CRUD Operations
- Working Relation records (ManyToOne, OneToMany, ManyToMany)
- Setting up for Content provider
- Working with
DataResolver
- Please report bug or isssues https://github.com/oogbox/mobile-orm/issues
- or write us on [email protected]
- Follow us on Twitter: @oogbox