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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 15:05:33  来源:igfitidea点击:

Is Hibernate an overkill for an Android application?

javaandroidperformancehibernate

提问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应用程序-尤其是考虑到代码的大小和依赖的数量。

http://ormlite.com/sqlite_java_android_orm.shtml

http://ormlite.com/sqlite_java_android_orm.shtml

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 Sebastian Roth

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

是的,休眠太多了,其他人已经在寻找替代方案。

Read here:

在这里阅读:

Pick yours. :-)

选择你的。:-)