60

I'm looking for a good ORM for my android application and at first glance it seems like for a mobile device I would prefer to use something simpler maybe. The thing is I'm just assuming here with no real evidence, so I thought I would ask the community's opinion (maybe there's is someone that has been through the experience). It is a fairly large(for mobile) application and will be run on a dedicated tablet.

What does everyone else think ? Is Hibernate too much for an android application ? Will there be performance problems ?

What would you use instead if you think it is too much ?

I am aware there are other questions asking for alternatives, but I decided to ask since most of those questions simply assumed it was an overkill and asked for other options and I started wondering "Is it really and overkill ? Why ?" Due to my lack of experience I simply think it it, but can't really provide an answer if I'm asked to explain why. Is it performance ? Is it too much configuration (Which I don't mind) ?

Thanks!

bluediapente
  • 3,946
  • 5
  • 32
  • 38

3 Answers3

76

I'd like to recommend my ORMLite package. It was designed to be much less heavy compared to Hibernate (and iBatis). I think that Hibernate is too much for Android applications -- especially considering the size of the code and the number of dependencies.

The Android port of ORMLite makes direct calls to the Android database API. A number of applications have been delivered using ORMLite successfully.

Hibernate provides a number of features that cannot be supported by the Android database calls so you will be paying for complexity that you cannot even use. I'm also not sure it has a native Android backend. Using SQLite over JDBC is not officially supported by Android and I was unable to get it to work reliably.

Gray
  • 115,027
  • 24
  • 293
  • 354
  • 9
    Actually I ended up using ORMLite and just for posterity as you said, let me just say I recommend it 100%. It has great features, it is open source and has an active community. – bluediapente Feb 23 '11 at 21:02
  • @Gray What about this [GreenDAO far better then ORMLite](http://www.sitepoint.com/5-best-android-orms/). – CoDe Jan 21 '16 at 08:44
  • I'm not an Android programmer so I won't comment. I hear that the stats they are quoting are optimized to make look GreenDAO look good but I'm not surprised it is faster @Shubh. – Gray Jan 21 '16 at 21:00
  • Does ormLite support JPA annotations and implement JPA interface, or it has its own? – eastwater Aug 28 '17 at 20:34
  • It supports a subset of the annotations. It does not implement the interfaces @Sunnyday. – Gray Aug 28 '17 at 20:36
12

Yes hibernate is too much & others have searched for alternatives.

Read here:

Pick yours. :-)

Community
  • 1
  • 1
Sebastian Roth
  • 11,344
  • 14
  • 61
  • 110
6

There are quite a few questions similar to yours already. Start with:

though some of those questions might be outdated by now.

Community
  • 1
  • 1
Matt Ball
  • 354,903
  • 100
  • 647
  • 710
  • 2
    Do these duplicate questions get closed soon after or are they left open forever? I assume not, since there are a few duplicates in your post as well. It would be nice to have moderators roll a lot of those into one question (assuming they're very similar). – McStretch Nov 23 '10 at 16:50
  • @McStretch: not sure what you're asking. By "these duplicates," do you mean this current question? There isn't a single vote to close on it yet. No votes to close on the ones I linked, either. – Matt Ball Nov 23 '10 at 16:53
  • Yeah in general if the answers to questions are links to other posts, then wouldn't it seem appropriate to point this question to a pre-existing one? Voting to close is fine, but I think it should be taken one step further and rolled into the previous questions or something. It's not a big deal or anything, I'm relatively new so I'm asking a more experienced SO user what generally happens with duplicate questions. – McStretch Nov 23 '10 at 17:51
  • @McStretch: best place to ask is http://meta.stackoverflow.com – Matt Ball Nov 23 '10 at 18:08