views:

4684

answers:

9

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 DB 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 DB access works.

+8  A: 

This thread might give you some to explore: Lightweight Alternatives to Hibernate

AlexCuse
+1  A: 

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.

David Robbins
In Java code? Or in JavaScript code?
GWLlosa
I'm pretty sure what you're talking about is a Javascript solution intended purely for browser-based (Web) applications. I don't see how it relates to native app development for Android.
Brian Lacy
+5  A: 

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:

slf
i had good results with DB40... wanna checkout Active Android though...
Ben
https://www.activeandroid.com/ looks cool, I'm looking forward to giving it a spin
slf
+2  A: 

Check this : http://negentropiccoder.blogspot.com/

Pavel Lahoda
+2  A: 

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.

Pavel Lahoda
Sounds interesting, do you have already s.th. to have a look at / to try?Cheers,Martin
Martin Grotzke
+1  A: 

ActiveAndroid is being released soon has been released. http://www.activeandroid.com

Michael Pardo
Looks promising. Thanks for pointing it out!
GWLlosa
No problem. There's a sample app up now: https://www.activeandroid.com/help/sample-project/
Michael Pardo
@Michael: I know you're not trying anything shifty here, but can you please disclose your affiliation in your posts when you mention one of your own products on SO? I know your name is in the footer of the linked page, but we're trying to crack down on [astroturfing](http://en.wikipedia.org/wiki/Astroturfing) (which this is not), so we're asking everyone to follow the same disclosure guidelines. Thanks.
Bill the Lizard
Just a heads up, ActiveAndroid is not free.
Gerald Kaszuba
+4  A: 

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

http://ormlite.sourceforge.net/

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. Love to get feedback if anything is missing for Android developers.

Gray
I've just released 3.2 version of ORMLite which now supports Android database APIs natively -- i.e. no reliance on their crippled JDBC.
Gray
+2  A: 

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.

Chayy
A: 

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/

Anthony Topper