Any good ORM tools for Android development?

JavaAndroidSqliteOrmCrud

Java Problem Overview


Anyone working on the Android ('gPhone') have or know of a place where I can find a good ORM tool for it? The code is written in Java, and the database is SQLite. What I would like to find is a tool that given the object definition, can auto-generate the tables and the CRUD functions (that would be awesome), or, barring that, a tool that can take the table definition, the object definition, and auto-generate the CRUD functionality. The rub is that all of this must happen within the Android framework, which has its own conventions as to how database access works.

Java Solutions


Solution 1 - Java

Thought I'd just add my $0.02 here about my ORMLite package.

It is a lightweight replacement to Hibernate and uses native Android OS database calls to support SQLite on Android. It also supports many other database types using JDBC on other architectures. We have an Android mailing list for ORMLite questions.

Solution 2 - Java

This question cannot age but the suggested frameworks can. So, here is first a list of what I find important in such frameworks for comparison:

  • Is there a Maven or Gradle artifact? (that's a big plus depending on whether you use maven or gradle, obviously)
  • Is the code accessible in an easy way including a fast overview on commits to judge the activity? (code hosted on github is a definite plus for me, in that matter)
  • Release management: are there releases/release tags and artifacts for it? (there are some that are hosted on github and require either git clone or offer the master tarball for download - for me a big minus if not even release tags are set and addressed in the README)
  • as size matters I put up some hints where it was easy to get by (I did not download anything, so from those projects that offer no release artifacts there are no sizes)

And here is a list of frameworks with notes on the points above. I looked up some more like aBatis and Hadi but I added only those that had some activity after 2011.

I have not tried any of those but maybe I can spare current readers a bit of time by listing the nowadays active projects. Please add a comment if you know of other projects that satisfy some of the above points and have some serious development (over some time) going on.

EDIT (2013 Nov): updated the list to the current status of the projects. Some of these have added release tags to their github repos as well as Maven/Gradle support. Good work!

EDIT (2015 Apr): updated the list, added Sprinkles (as per comment by @AndroidGecko) and Realm.io.

Solution 3 - Java

If performance and code size matter, check out greenDAO. I'm the author of it, and my motivation to create another ORM was to avoid reflection in the hotspots. It turned out that greenDAO can be up to 4 times faster than ORMLite. Checkout the feature page for details.

Solution 4 - Java

I don't know of anything that is exactly what you are asking for, but there is an alternative to SQLite that you may find useful if your architecture requirements are flexible. It may be worth checking out db4o:

Solution 5 - Java

ActiveAndroid ($20) looks like it may be exactly what you need.

Solution 6 - Java

I liked ActiveAndroid. It's written specifically for Android it seems. That's feels like a plus to me.

I have some Ruby on Rails experience and if you like the Rails way of ActiveRecord you can very quickly get moving with this library.

https://www.activeandroid.com/

Solution 7 - Java

I'm also looking for an ORM on Android. I tested ActiveAndroid, NeoDatis and db4o, and I think that I'll use one of the two last.

NeoDatis and db4o are really similar, so I would like some advice to choose the best one. Is someone using one of them on his project ? I'll use it for free and paid app, but it seems that the two haven't any license limitation for Android.

There is a benchmark here that seems to say that NeoDatis is faster than db4o, but I don't know if we can base my opinion on this.

Solution 8 - Java

https://github.com/ahmetalpbalkan/orman

Orman framework might help you. It is especially designed for that and very small and useful.

Solution 9 - Java

One more newcomer: android-active-record. It's very lightweight and easy for use persistence framework for Android backed by SQLite http://code.google.com/p/android-active-record/

Solution 10 - Java

ActiveRecordJS from Aptana is a Javascript ORM that should run on the gPhone. It is designed to work with Jaxer and Gears. When you user the Jaxer Adapters, you can connect to SQLLite.

UPDATE: I don't think I made it clear, but ActiveRecordJS is an ORM that runs client side, which could be an advantage to you on the gPhone.

Solution 11 - Java

http://hadi.sourceforge.net

This tool is very simple and easy to use.

Solution 12 - Java

I have developed my own implementation of the JPA ORM for Android. It is not yet fully feature complete, but you can annotate class with the @Entity, @Id, @Column annotations and you get JPA entities that can be stored and retrieved from the SQLite database. It needs some more features & cleanup before I'll post it to the public, but if there is enough interest it might accelerate my effort.

Solution 13 - Java

Even though this is an old post, the topic is still relevant. Hence, I want to share an interesting article and nice approach to solving most of the issues mentioned in the question:

http://blog.codecentric.de/en/2011/04/android-persistence-accelerated-small-inhouse-orm/

Hope anyone finds this as useful as myself!

Solution 14 - Java

My own DroidParts /http://droidparts.org/ just reached v0.5. It's a DI/ORM library & more.
Not much documentation, but includes a sample app.

Solution 15 - Java

Had negative experience with db4o (v. 8): indexing didn't work properly (exception etc.). So I didn't managed how to avoid creating duplicates in foreign tables when having object in object structure. More detailed explanation in my question. Hope one day it would be better.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGWLlosaView Question on Stackoverflow
Solution 1 - JavaGrayView Answer on Stackoverflow
Solution 2 - JavaRisadinhaView Answer on Stackoverflow
Solution 3 - JavaMarkus JungingerView Answer on Stackoverflow
Solution 4 - JavaslfView Answer on Stackoverflow
Solution 5 - JavaMichael PardoView Answer on Stackoverflow
Solution 6 - JavaTony TopperView Answer on Stackoverflow
Solution 7 - JavaChayyView Answer on Stackoverflow
Solution 8 - Javaahmet alp balkanView Answer on Stackoverflow
Solution 9 - JavaVladimir KrozView Answer on Stackoverflow
Solution 10 - JavaDavid RobbinsView Answer on Stackoverflow
Solution 11 - Java9tcatView Answer on Stackoverflow
Solution 12 - JavaPavel LahodaView Answer on Stackoverflow
Solution 13 - JavaSgaliView Answer on Stackoverflow
Solution 14 - JavayanchenkoView Answer on Stackoverflow
Solution 15 - JavaOleksii MalovanyiView Answer on Stackoverflow