Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 25
Registered: ‎09-08-2008
My Device: Not Specified

Unable to get the object from persistant store of simulator.

Hi,

 

I am using JDE 1.5 MDS simulator, and iam storing one vector object in persistent store, immediately i can able get this stored object at this time so it is working fine. But Once If i close the simulator and start it again, then i am unable to get that stored object.  Iam using below code

public static PersistentObject _store = PersistentStore.getPersistentObject(0x2f4b60db4f02308bL); Vecor vectorObject = new Vector(); ComponentVO info = new ComponentVO(); //This is vo vectorObject.addElement(info); synchronized (_store){ _store.setContents(vectorObject); _store.commit(); } //for get the stored object public Vector readVoFromPersistentStore() { synchronized (_store){ return (Vector)_store.getContents(); } }

 

 

Please provide your solution for this.  Advanced Thanks.

 

Regards

Sunil.G

Developer
Posts: 16,639
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Unable to get the object from persistant store of simulator.

do you call PersistentStore.getPersistentObject() when reading?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 25
Registered: ‎09-08-2008
My Device: Not Specified

Re: Unable to get the object from persistant store of simulator.

Yes,  I have mentioned 'PersistentStore.getPersistentObject()'  this you can find in my first post having first line in code. That is

public static PersistentObject _store = PersistentStore.getPersistentObject(0x2f4b60db4f02308bL);

iam getting values also from store,  but I am unable to get the same when i trying to get the values after simulator restart. Againg i have to store the object in persistentObject then only i can retrieve.

 
Developer
Posts: 19,623
Registered: ‎07-14-2008
My Device: Not Specified

Re: Unable to get the object from persistent store of simulator.

Are you starting the Simulator separately, or under control of the JDE?  What level JDE are you using?  You say 1.5, but I suspect you mean 4.5?

 

I've not looked seriously at this, but I think I have found that if I start the Sim from the JDE, typically after making a few changes in my application, then it will restart the simulator and delete Objects associated with my app.  I guess it does this on the grounds that what I have really done, is delete my app, change it, then reinstall and restart the device.  I think this is probably reasonable, though a little annoying if all I've done is change a Screen.....