greenDAO 1.2 Release

greenDAO V1.2.0 comes with new features and an important bug fix. We recommend everyone to upgrade.

New features and fixes in V1.2.0:

  • Limited support of String PKs (no relations using String FKs yet)
  • Fixed index creation (please update your schema)
  • Added autoincrement() creating AUTOINCREMENT PKs
  • Added CountQuery for creating SELECT COUNT (*) queries with QueryBuilder
  • Added getDatabase in DaoMaster, DaoSession, and Dao
  • Added insertOrReplaceInTx in Dao
  • Added deleteInTx in Dao
  • Made DAOs and DaoSessions in active entities transient (allows serialization of entities)
  • Minor fixes

For the first time greenDAO supports entity without an long/Long PK. String PK are sometimes nice for key/value maps and caches. Starting with version 1.2.0 you can model those entities without an ID column, and directly load entities by its String PK saving you another query. There’s a limitation though in this version: entities with a String PK cannot be targeted of relations.

Action required to fix indexes: A bug in previous releases prevented database indexes from being generated. If you defined indexes before using greenDAO’s generator, it’s time to update your schema. One way you can do this is call the static createTable method of DAOs with indexes. The method’s second parameter is a flag indicating whether a “IF NOT EXISTS” semantic should be used. When updating your schema (SQLiteOpenHelper.onUpdate) you can call this method and pass true as this second parameters. This way only the missing indexes will be created because your tables already exist. If you do not have to migrate your data and you use DevOpenHelper, you can just increase your schema version. This way everything will be rebuild (dropped and created again) the next time you launch the app.

This entry was posted in News and tagged index, indices, , String PK, V1.2. Bookmark the permalink.

2 Responses to greenDAO 1.2 Release

  1. Yuriy Yarovoy says:

    Cool! Thanks for release!

  2. Janek says:

    Thanks! I really like that entities can now be serialized – this allows putting them into intents/bundles which simplifies a lot.

Comments are closed.