01-20-2009 09:30 PM
Reading through the developer guide I read this
The following native data types can also be stored persistently:
Previously I was looking for a way to store a BlackBerryContact Object persistently. The answer was that basically it can only be done by reimplmenting the class myself. However, if Objects can be stored, would it be possible to cast the BlackBerryContact as an Object, store it, and then cast it back after retrieval?? It seems a little to simple to actually work, but I figured I might as well ask. Happy Obama Day!!
Solved! Go to Solution.
01-21-2009 03:17 AM - edited 01-21-2009 03:18 AM
It is not recommended to store external class instances directly.
External means that these classes are not yours.
For example - if you created an instance of class com.mycompany.myapp.MyClass and stored it in persistent store - then when you uninstall your application - these class instances are going to be removed too from the persistent store.
But if you save class instance like java.util.Vector, or BlackberryContact directly - they will remain in persistent memory even your app is uninstalled.
It is not a good approach.
Use Memento design pattern.
Create a class which instance stores snapshot of information from a BlackberryContact instance and store it into persistent memory.
01-21-2009 03:37 AM
01-21-2009 04:26 AM - edited 01-21-2009 04:27 AM