Higher level database layer for Android?

前端 未结 12 1582
失恋的感觉
失恋的感觉 2020-12-13 04:51

Are there any good database abstraction layers/object relational mappers/ActiveRecord implementations/whatever they are called for Android? I\'m aware that db4o is officiall

相关标签:
12条回答
  • 2020-12-13 05:01

    Try ActiveAndroid. It is free and open source (Apache Version 2.0).

    From the website:

    ActiveAndroid is an active record style ORM (object relational mapper). [...] ActiveAndroid allows you to save and retrieve SQLite database records without ever writing a single SQL statement. Each database record is wrapped neatly into a class with methods like save() and delete().

    [...] Accessing the database is a hassle, to say the least, in Android. ActiveAndroid takes care of all the setup and messy stuff, and all with just a few simple steps of configuration.

    0 讨论(0)
  • 2020-12-13 05:02

    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?

    0 讨论(0)
  • 2020-12-13 05:03

    Have a look at Androrm. It is open source and well documented (see here). If you ever worked with django, you will notice, that the syntax is very similar.

    Androrm also supports abstraction classes for the most common field types, plus relational fields. This way it enables you to query for your data in an very easy manner with only very little effort on your side.

    0 讨论(0)
  • 2020-12-13 05:09

    I have written a new ORM, for android, that's aimed and being as easy as possible to implement. It support lists and SQL free migration a couple things which I always found had an overhead in other libraries.

    http://www.rushorm.com/

    0 讨论(0)
  • 2020-12-13 05:15

    I faced the same problem and looked at both android-active-record and ActiveAndroid. I found android-active-record didn't handle the things I cared about (relationships for example), and ActiveAndroid isn't free. Therefore, I decided to write my own library. It's called AndroidRecord and it's hosted on GitHub and you're free to do with it what you want (I think I'm going to go with the MIT license). I use this every day and I'm content with it, but I'd love to get feedback.

    If you need to know how to use it, I'm working on the documentation. If you need it right away, you can check out this lame example project which should be enough to dip your toes in. You can also email me of course.

    0 讨论(0)
  • 2020-12-13 05:16

    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

    0 讨论(0)
提交回复
热议问题