Announcement

Poetry

Poetry is an Android persistence library that allows you to persist a JSON object tree directly into an SQLite database through OrmLite. Poetry enables you to write less code and persist data much faster.

Demo

Behaviors

Models that are imported more than once within a single JSON tree are updated every time they are processed.

Attributes that are not specified in JSON are not updated

Attributes that are imported with null value will have a null value in the database. Make sure your model allows this.

When you use JsonPersister's persistArray() method, it will import the array and delete all objects from the database that do not correspond to any of the imported IDs.

Tutorial

Creating a DatabaseHelper

The Poetry DatabaseHelper allows you to easily configure your database. In the example below, you can see a custom DatabaseHelper with a DatabaseConfiguration that holds the model version and model classes.

Arrays of base types

Arrays of base types work the same as one-to-many relationships. The only difference is that you have to define a model that holds the base types and use the @ForeignCollectionFieldSingleTarget annotation to specify the database column name that holds the value.