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: 193
Registered: ‎04-27-2009
My Device: Not Specified
Accepted Solution

removeAllelement() method of vector remove data from persistant storage

Hi,

I am storing a vector in the persistant storage .when i am using removAllelement() method of vector to remove all the element from vector this removes data from the persistant storage.why  device is behaving like this.I am using blackberry 8900 OS 4.6.1.

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

Re: removeAllelement() method of vector remove data from persistant storage

the object stored is the same your are currently handling. if another application performs a commit on a persistant stores ALL stores are persisted and your empty vector is written into the persistant store, even without you committing it.

you can copy the stored vector if you want to modify it without altering the stored one.

----------------------------------------------------------
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: 193
Registered: ‎04-27-2009
My Device: Not Specified

Re: removeAllelement() method of vector remove data from persistant storage

I am not doing any commit operation after  removing all the elements from vector.In my case why this is happening.

Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: removeAllelement() method of vector remove data from persistant storage

Hi,

 

It's strange behavior. I do removeAll() a lots without this side effect.

 

I know another reason why persistent store can be cleared - if you store your own classes and do uninstall application before new installation. 

 

To check all commits you can also try next trick - write wrapper for persistent object and call commit of wrapper instead of PO. Log this event or check in debug. After that you will be 100% sure that commit isn't called.

 

Thanks,

Eugen

Highlighted
Developer
Posts: 17,019
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: removeAllelement() method of vector remove data from persistant storage

as MSohm said in another post it is sufficient for another application, even a system app, calling commit on ANY persistant store to commit all pending changes. if you want temporary modifications work on a copy.

----------------------------------------------------------
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