user681443
user681443

Reputation: 267

clarification on blackberry persistent store

I have a blackberry app that's already been deployed and I'm currently working on an update for the app. In the existing app, I use a persistent store that stores 3 primitives (int, String and String). In this update I decided to add a new String to the persistent store. My question is this, will the "new" String somehow affect the app when users upgrade? Will the app just simply add in the new String to the existing persistent store or will it wipe the existing persistent store completely and create a fresh one because of the new String? Thanks

Upvotes: 1

Views: 53

Answers (1)

Adwiv
Adwiv

Reputation: 1266

If the object being persisted is your own class and you add a variable to it, then it will wipe out the existing data completely. The reason is that once the class changes, the system cannot deserialize your older object anymore. To handle the current situation, if you want to preserve the original data, do not make any changes to the original class.

Add the additional variable in another persistent object. This time take care to ensure that your object can handle additional data that you may need to save in the future.

The best way is to create such a class is by extending a collection class - like an IntHashtable or a Hashtable or a Vector and use it to store your settings data.

Upvotes: 3

Related Questions