Java Hibernate 对 Android 应用程序来说是一种矫枉过正吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4257374/
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
Is Hibernate an overkill for an Android application?
提问by bluediapente
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.
我正在为我的 android 应用程序寻找一个好的 ORM,乍一看似乎对于移动设备我更喜欢使用更简单的东西。问题是我只是在这里假设没有真正的证据,所以我想我会询问社区的意见(也许有人经历过这种经历)。它是一个相当大的(用于移动)应用程序,将在专用平板电脑上运行。
What does everyone else think ? Is Hibernate too much for an android application ? Will there be performance problems ?
其他人怎么看?对于 android 应用程序来说,Hibernate 是否太多了?会不会有性能问题?
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!
谢谢!
采纳答案by Gray
I'd like to recommend my ORMLitepackage. It was designed to be muchless heavy compared to Hibernate (and iBatis). I think that Hibernate istoo much for Android applications -- especially considering the size of the code and the number of dependencies.
我想推荐我的ORMLite包。与 Hibernate(和 iBatis)相比,它的设计重量要轻得多。我认为,休眠是太多了Android应用程序-尤其是考虑到代码的大小和依赖的数量。
The Android port of ORMLite makes direct calls to the Android database API. A number of applications have been delivered using ORMLite successfully.
ORMLite 的 Android 端口直接调用 Android 数据库 API。许多应用程序已经使用 ORMLite 成功交付。
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.
Hibernate 提供了许多 Android 数据库调用无法支持的功能,因此您将为甚至无法使用的复杂性付出代价。我也不确定它是否有原生的 Android 后端。Android 不正式支持通过 JDBC 使用 SQLite,我无法让它可靠地工作。
回答by Matt Ball
There are quite a few questions similar to yours already. Start with:
已经有很多与您类似的问题了。从...开始:
- ORM on android SQLite and database scheme
- Any Good ORM tools for Android development?
- Light weight alternative to Hibernate?
- Are there any good ORMs (preferably JPA implementations) that support SQLite (on Android)?
- Higher level database layer for Android?
- Android object handling / persistence
- android SQLite和数据库方案上的ORM
- Android 开发有什么好的 ORM 工具吗?
- Hibernate 的轻量级替代品?
- 是否有任何好的 ORM(最好是 JPA 实现)支持 SQLite(在 Android 上)?
- Android的更高级别的数据库层?
- Android 对象处理/持久化
though some of those questions might be outdated by now.
尽管其中一些问题现在可能已经过时了。
回答by Sebastian Roth
Yes hibernate is too much & others have searched for alternatives.
是的,休眠太多了,其他人已经在寻找替代方案。
Read here:
在这里阅读:
- portable lightweight java orm framework for android
- Any good ORM tools for Android development?
- Light weight alternative to Hibernate?
Pick yours. :-)
选择你的。:-)