views:

723

answers:

5

Are there any good database abstraction layers/object relational mappers/ActiveRecord implementations/whatever they are called for Android? I'm aware that db4o is officially supported, but it has quite a large footprint and I'd rather use a more conventional database (SQLite).

A: 

SQLite is explicitly part of Android:

http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html

However you might have to create your own abstraction layer (query builder for simple queries), or otherwise deal with SQL.

Maybe http://developer.android.com/reference/android/database/sqlite/SQLiteQueryBuilder.html is what you need?

JeeBee
I know there's SQLite built in to Android: what I am looking for is something more high-level.
A: 

There's also Neodatis and Perst (Lite).
I've toyed with Perst a year ago and concluded it's not worth it.
After all, a) Android runs on a rather restricted device with ~16mb of heap space per app and b) You customers would really appreciate performance and low power consumption.
So my advice is to go with SQLite and hand-written SQL. It's not hard at all and the wrappers provided by Android SDK are really nice.

alex
+1  A: 

Try ActiveAndroid. There's a sample app here: https://www.activeandroid.com/help/sample-project/

Michael Pardo
A: 

There is an 'android-active-record' project which provides ActiveRecord abstraction for accessing Android SQLite database. It's available here: http://code.google.com/p/android-active-record

It allows to eliminate most of boilerplate coding when performing CRUD operations on database entities and also minimizes efforts for creating/maintaining a database structure

Vlad
A: 

ORMLite was designed to be very small but still provide higher level functionality. We have recently released the 3.2 version which makes calls to the native Android OS database APIs to support its ORM functionality. Love to get some feedback from more Android developers.

Gray