1

I need to persist a object. Unfortunately sqlite in android does not support ORM. Therefore I need to choose a different way to persist my data.

Is it better to persist the data via java serialization (ObjectOutputStream) within a blob, or via Gson's json serialization as a json string? Afterwards I need to serialize the data again as a json string in order to transmit it to a restful wcf service.

I'm worried about the serialization speed because afaik working with strings isn't very efficient.

Joseph Quinsey
  • 9,553
  • 10
  • 54
  • 77
user1168876
  • 157
  • 3
  • 14
  • did you try ORMLite which is compatible with Android & SQLite ?? for more info check - http://ormlite.com/sqlite_java_android_orm.shtml – Rakhita Jan 25 '12 at 10:05

1 Answers1

0

In my experience serialization works faster than gson, but I haven't done any test on it. If speed is of concern I'd recommend you to do that test yourself.

On another note, you can use ORM on java/Android, read here: Any good ORM tools for Android development?

Community
  • 1
  • 1
Warpzit
  • 27,966
  • 19
  • 103
  • 155