Question

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. Right now the data is sendt to the app from a php page in json. This all works.

Now my question is : How to store the items? Should I convert them to Java objects? Or should I store them as json objects/arrays?

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):

[{"ID":"2","day":"Friday","date":"Friday 10 August","mainTitle":"test","subTitle":"testevent","hour":"19.30 ","info":"this is a testevent","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. 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.

Was it helpful?

Solution

I've only used db4o with Java before, but I would convert them into Java objects. 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.

Here is a tutorial for db4o. Native queries are in section 3.2: http://www.db4o.com/about/productinformation/resources/db4o-6.3-tutorial-java.pdf

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top