nhachicha/SnappyDB

Unable to upgrade DB schema

kshitijkumar23-zz opened this issue · 2 comments

I'm using SnappyDB for my project. It works fine to save and retrieve data. But when I added one more field to my POJO class, it failed to read saved data with following exception: com.esotericsoftware.kryo.KryoException: Unable to find class: T���. Is there way to provide database versioning with SnappyDB and upgrade model classes without fail?

You can set Kryo to use CompatibleFieldSerializer.

Kryo kryo = new Kryo();
kryo.setDefaultSerializer(CompatibleFieldSerializer.class);
DB snappy = DBFactory.open(context, kryo);

See https://github.com/EsotericSoftware/kryo#compatibility to see the available options.

Adding this to the readme would be useful :)