Before I started developing on Android in early 2009, I had very much enjoyed the blessings of Ruby’s ActiveRecord object-relational adapter which makes development very easy and fast compared to such heavyweight und – for my taste – cumbersome approaches as the DAO/JPA-Template/Hibernate layer cake that is commonly found in the Spring-dominated world of Java server development. But what I encountered when I first used Android’s way of creating and accessing SQLite databases was even worse than that. You get the least thinkable amount of support from the system and have to write your mapping and persistence logic (table creation, finders, etc.) as a thin layer directly on top of the SQL query interface.
Hurz.
As a remedy, I used and still use SQLiteGen in some of my projects, which generates a glue layer in the form of Java beans, as directed by the developer through Java annotations. It works, but project development seems to have run dry and the current version could use several improvements.
That’s why I started to look for something new and, a few weeks ago, stumbled across Sugar, a simple but effective object-relational mapper that imitates the behavior of ActiveRecord, mainly by using reflection to inspect the data structures that are mapped to database tables. I liked its general approach and forked Sugar on GitHub to convert it into an Android library project, fix some issues and inject new features, such as support for Enum-typed fields. If you are a an Android developer looking for an alternative way of mapping between your application model and your database, maybe you should give Sugar a spin.