选择一个ORM的Andr​​oid项目(最小API级别7) [英] Choosing an ORM for Android project (min. API level 7)

查看:144
本文介绍了选择一个ORM的Andr​​oid项目(最小API级别7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在有一个应用程序,它的主要性能问题是使用基于文件的数据库由JSON响应。

我想重写我的应用程序使用SQLite数据库功能。
因为我很懒,我想使用某种ORM的。

到目前为止,我只发现了两个大的ORM库:

我的主要目标是为提高对使用数据尽可能的性能

但我发现这些库中的两个可能的问题。

  • ORMLite使用注释,这是pre-蜂窝大性能问题因的这个bug

  • GreenDAO正在使用某种code发电机,这将我慢下来的发展,我会写发电机,然后用产生的code。而且我不很喜欢这个主意。

  • DB4O是JPA,我一直认为是缓慢而沉重的内存使用情况,因此不适合低端设备(记得了Android API V7)


广告@ChenKinnrot
预计负荷应足以考虑使用ORM。
在我的情况下,它是约25-30独特的表,和至少10个表连接(2 - 4桌在同一时间)。大约300-500独特的字段(列)


所以,我的问题是:

  1. 我应该使用ORM / JPA层的Andr​​oid应用程序?
  2. 如果有,是什么库,你会建议我使用?(并请加一些参数也是如此)
解决方案

我用ORMLite,并发现它简单的,一旦你得到了它的窍门(几个小时),功能相当强大,并没有造成任何性能问题(应用程序在姜饼的HTC渴望和HTC Hero的)进行测试。

我将再次使用它在任何项目中,我需要使用数据库的。

I currently have an application, where it's primary performance issue is using file-based database consisted of JSON responses.

I'd like to rewrite my application to use SQLite database feature.
Since I'm lazy, I'd like to use some kind of ORM.

So far I have found only two big ORM libraries:

My primary goal is to raise performance on working with data as much as possible

But I've found two possible issues with those libraries.

  • ORMLite uses annotations, which is big performance issue in pre-honeycomb due to this bug

  • GreenDAO is using some kind of code generator, and that would slow me down on development as I would have to write generator, and then use generated code. And I don't very like this idea.

  • DB4O is JPA, which I've always considered as slow and heavy on memory usage, therefore unsuitable for low-end devices (remember the Android API v7)


ad @ChenKinnrot:
The estimated load should be sufficient to think about using an ORM.
In my case it is about 25-30 unique tables, and at least 10 table joins (2 - 4 tables at a time). About 300-500 unique fields (columns)


So my questions are:

  1. Should I use ORM/JPA layer in Android application?
  2. If so, what library would you recommend me to use? (and please add some arguments too)

解决方案

I've used ORMLite and found it straightforward once you got the hang of it (a few hours), quite powerful and didn't cause any performance problems (app tested in Gingerbread on HTC desire and HTC Hero).

I will be using it again in any projects I need to use a DB for.

这篇关于选择一个ORM的Andr​​oid项目(最小API级别7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆