简体   繁体   English

格式化以存储在android应用中的db4o

[英]Format to store in db4o in an android app

I'm working on an android project for a local community 'festival' and the android app should sync with an online database everytime it starts up, and then store the data on android in db4o. 我正在为本地社区“节日”开发一个android项目,并且每次启动时android应用都应该与在线数据库同步,然后将数据存储在db4o中的android上。 Right now the data is sendt to the app from a php page in json. 现在,数据已从json中的php页面发送到应用程序。 This all works. 所有这一切。

Now my question is : How to store the items? 现在我的问题是:如何存储物品? Should I convert them to Java objects? 我应该将它们转换为Java对象吗? Or should I store them as json objects/arrays? 还是应该将它们存储为json对象/数组?

I have to be able to retreive the objects by day (like all the events of Friday) and also get one specific event with all the info to display all the info on the screen (like day, time of event, free or not ...) all this info is in the online database and is received by the androidapp like this (in JSON): 我必须能够按天检索对象(如星期五的所有事件),并且还必须获得一个包含所有信息的特定事件,才能在屏幕上显示所有信息(如日期,事件发生的时间,是否空闲)。 。)所有这些信息都位于在线数据库中,并由androidapp接收,如下所示(在JSON中):

[{"ID":"2","day":"Friday","date":"Friday 10 August","mainTitle":"test","subTitle":"testevent","hour":"19.30 ","info":"this is a testevent","free":"0"}] [{{“ ID”:“ 2”,“ day”:“星期五”,“ date”:“ 8月10日星期五”,“ mainTitle”:“ test”,“ subTitle”:“ testevent”,“ hour”:“ 19.30 “,” info“:”这是一个测试事件“,” free“:” 0“}]

I haven't used db4o yet and I would appreciate if someone could point me in the right direction on what would be best in this situation. 我还没有使用过db4o,如果有人可以向我指出在这种情况下最好的方法,我将不胜感激。 I did read alot of info about db4o so I am able to create a database , store some objects in it and empty the db to put the new info in it. 我确实阅读了很多有关db4o的信息,所以我能够创建一个数据库,在其中存储一些对象,然后清空db以将新信息放入其中。

I've only used db4o with Java before, but I would convert them into Java objects. 我以前只将db4o与Java一起使用,但是我会将它们转换为Java对象。 db4o's Java native queries are very easy to use, and will allow you to get all objects that fit certain criteria, such as all the objects that are on a certain day, or have the object ID of the object that you want to display on the screen. db4o的Java本机查询非常易于使用,并允许您获取符合特定条件的所有对象,例如某天的所有对象,或者具有要在其上显示的对象的对象ID。屏幕。

Here is a tutorial for db4o. 这是db4o的教程。 Native queries are in section 3.2: http://www.db4o.com/about/productinformation/resources/db4o-6.3-tutorial-java.pdf 本地查询在3.2节中: http : //www.db4o.com/about/productinformation/resources/db4o-6.3-tutorial-java.pdf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM