Java Android 开发有什么好的 ORM 工具吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/371538/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Any good ORM tools for Android development?
提问by GWLlosa
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.
任何在 Android ('gPhone') 上工作的人都有或知道一个可以为它找到好的 ORM 工具的地方?代码是Java编写的,数据库是SQLite。我想找到一个工具,它给出了对象定义,可以自动生成表和 CRUD 函数(这太棒了),或者,除此之外,一个可以获取表定义、对象定义的工具,并自动生成 CRUD 功能。问题是所有这些都必须在 Android 框架内发生,该框架对于数据库访问的工作方式有自己的约定。
回答by David Robbins
ActiveRecordJSfrom 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.
Aptana 的ActiveRecordJS是一个应该在 gPhone 上运行的 Javascript ORM。它旨在与 Jaxer 和 Gears 一起使用。当您使用 Jaxer 适配器时,您可以连接到 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.
更新:我想我没有说清楚,但 ActiveRecordJS 是一个运行客户端的 ORM,这对您在 gPhone 上可能是一个优势。
回答by slf
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:
我不知道有什么正是您所要求的,但是如果您的架构要求灵活,那么您可能会发现 SQLite 的替代方案很有用。可能值得检查一下db4o:
回答by Pavel Lahoda
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.
我已经为 Android 开发了自己的 JPA ORM 实现。它的功能还没有完全完成,但是您可以使用@Entity、@Id、@Column 批注对类进行批注,并获得可以从 SQLite 数据库存储和检索的 JPA 实体。在我将它发布给公众之前,它需要一些更多的功能和清理,但如果有足够的兴趣,它可能会加速我的努力。
回答by Michael Pardo
ActiveAndroid($20)looks like it may be exactly what you need.
ActiveAndroid (20 美元)看起来可能正是您所需要的。
回答by Gray
Thought I'd just add my $0.02 here about my ORMLite package.
以为我只需在此处添加有关我的ORMLite 包的0.02 美元。
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 listfor ORMLite questions.
它是 Hibernate 的轻量级替代品,并使用原生 Android 操作系统数据库调用来支持 Android 上的 SQLite。它还支持在其他体系结构上使用 JDBC 的许多其他数据库类型。我们有一个用于 ORMLite 问题的Android 邮件列表。
回答by Chayy
I'm also looking for an ORM on Android. I tested ActiveAndroid, NeoDatisand db4o, and I think that I'll use one of the two last.
我也在寻找 Android 上的 ORM。我测试了ActiveAndroid、NeoDatis和db4o,我想我会最后使用两者之一。
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.
NeoDatis 和 db4o 非常相似,所以我想请教一些选择最好的建议。有人在他的项目中使用其中之一吗?我会在免费和付费应用程序中使用它,但两者似乎对 Android 没有任何许可限制。
There is a benchmark herethat seems to say that NeoDatis is faster than db4o, but I don't know if we can base my opinion on this.
有一个标杆在这里,似乎说NeoDatis比db4o的速度更快,但我不知道我们是否能在此基础上我的意见。
回答by Tony Topper
I liked ActiveAndroid. It's written specifically for Android it seems. That's feels like a plus to me.
我喜欢 ActiveAndroid。它似乎是专门为Android编写的。这对我来说是一个加分项。
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.
我有一些 Ruby on Rails 经验,如果你喜欢 ActiveRecord 的 Rails 方式,你可以很快开始使用这个库。
回答by Vladimir Kroz
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/
另一个新人:android-active-record。它非常轻巧且易于使用,由 SQLite http://code.google.com/p/android-active-record/支持的 Android 持久化框架
回答by AhmetB - Google
https://github.com/ahmetalpbalkan/orman
https://github.com/ahmetalpbalkan/orman
Orman framework might help you. It is especially designed for that and very small and useful.
Orman 框架可能会帮助你。它是专门为此而设计的,非常小巧实用。
回答by 9tcat
This tool is very simple and easy to use.
这个工具非常简单易用。