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.


当前回答

有db4o的负面经验(第8节):索引不能正常工作(异常等)。所以我没有设法避免在对象结构中有对象时在外部表中创建重复。更详细的解释在我的问题。希望有一天会好起来。

其他回答

ActiveAndroid(20美元)看起来可能正是你所需要的。

我自己的DroidParts /http://droidparts.org/刚刚发布了0.5版。它是一个DI/ORM库等等。 没有太多的文档,但是包含了一个示例应用程序。

还有一个新来者:android-active-record。 它是一个非常轻量级且易于使用的持久性框架,支持SQLite http://code.google.com/p/android-active-record/

虽然这是一篇旧文章,但这个话题仍然是相关的。因此,我想分享一篇有趣的文章和解决问题中提到的大部分问题的好方法:

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

希望任何人发现这和我一样有用!

我已经为Android开发了我自己的JPA ORM实现。它还没有完全完成功能,但是您可以使用@Entity、@Id、@Column注释注释类,并且您可以获得可以从SQLite数据库存储和检索的JPA实体。在我将它发布到公众之前,它需要更多的功能和清理,但如果有足够的兴趣,它可能会加速我的努力。