Persistent objects

I know there is a problem with the definition of an object persistent in a library if two or more applications will use.

But he is sure to have an object in a library that other applications it will be extended to an object persistent more complex?

Which always causes an error with the persistent store?

Sorry, I have contributed to some discussions and I do not remember that you speak...

It was probably two applications, eager to share an object.  And the point that if they share an object, they must also share the full qualified class, which means that have to share a library containing this class.

In any case two different GUIDS should mean that you have no problem. However, the library should be deleted, both will go.

Tags: BlackBerry Developers

Similar Questions

  • change the value of an object in the content of the persistent object

    Hello

    I'm triyin to make a customizable menu, saving the preferences of the user as a custom class in a hash table which is the content of my persistent object.

    the custom class "Favoritos" is like this:

    public class Favoritos implements Persistable {
          private Boolean[] misFavoritos = new Boolean[10];
    
          public Favoritos() {
            super();
        }
    
        public Boolean[] getMisFavoritos() {
            return misFavoritos;
        }
    
        public void setMisFavoritos(Boolean[] misFavoritos) {
            this.misFavoritos = misFavoritos;
        }
    }
    

    and the hash table custom:

    public class CustomHashtable extends Hashtable implements Persistable {
    
    }
    

    in my menu configuration screen, I show the options selected as Favorites, which are defined as true in Boolean Favoritos object table in the hashtable. I retrieve the values or set them all as false if they have not been registered before, like this:

    PersistentObject persistentObject = PersistentStore.getPersistentObject(KEY);
    if(persistentObject.getContents() != null){
        CustomHashtable persistentHashtable = (CustomHashtable) persistentObject.getContents();
        if(persistentHashtable.containsKey("misFavoritos")){
        misFavoritos = ((Favoritos) persistentHashtable.get("misFavoritos"));
        }
        else{
        misFavoritos = new Favoritos();
        Boolean[] f = {new Boolean(false), new Boolean(false), new Boolean(false), new Boolean(false), new Boolean(false),
                  new Boolean(false), new Boolean(false), new Boolean(false), new Boolean(false), new Boolean(false)};
        misFavoritos.setMisFavoritos(f);
        persistentHashtable.put("misFavoritos", misFavoritos);
        persistentObject.commit();
        }
    }
    

    So I give to the user the possibility to define as true certain values and Boolean table, I try to change them this way:

    misFavoritos.getMisFavoritos()[i] = new Boolean(true);
    persistentHashtable.put("misFavoritos", misFavoritos);
    persistentObject.commit();
    

    Changes are persisted as I navigate the application, I want to say, if I close the configuration screen and open another configuration screen, changes of this show, but I I close application it loosse changes made a show all the elements of the array as false. What I do wrong?

    RuntimeStore is the other location people will such things, but it is cleared to restart the device, not the app.

    If you want to have something that you have to restart the application, then keep your storage apps and turn it off when leaving.

  • Question about the persistent object

    Hello

    When I used to store data using persistent object, data also will be deleted after uninstalling the app.

    Is there any data keep possibility even if the app is uninstalled?

    Can anyone give me a suggestion on this?

    Thank you.

    Objects are deleted when no request refers to them.

    So, if you have implemented a custom persistable object, whis would explain the removal.

    Use "Vanilla" persistable objects in the store, such as Hashtable.

  • How to exclude the field of persistent object

    Hello

    Is it possible to substitute the PersistanceStore method to persist objects?

    I have a complex data structure I need to store. One of the internal classes contain no persistent field. When I'm storing the data I don't no need to store this field, but the compiler triggers error.

    ... Widget: error! : class... Persistable marked widget by interface:... Persistable is not persistent: _field field: class... Field does not implement net.rim.vm.Persistable

    Is the way to override the implementation of this class persitant and exclude the problematic areas?

    Thanks for the reply.

    I did something similar, I created a class of data for persistence and a class of execution with additional fields.

    It's not very practical, these classes are deep into a tree of complex data, but I guess that's how it should work with BlackBerry.

  • Deleting persistent objects on uninstall

    If an application defines a class that implements Persistable, all persistent objects of this class are deleted when the application is uninstalled. It is logical and it is clear from the documentation. What is not clear, is what happens if your application is still a standard container (for example, a hash table) that in turn contains a Persistable custom class instances. The container class is deleted also? I guess it must be, otherwise, it would end up by plenty of broken references.

    Yes, it will also get deleted.

    If your problem has been solved to then please mark the thread as "Accepted Solution" and congratulations - your wish

  • Doubt about the persistent object

    Hi friends,

    I've stored data object persistent after that some time, my Simulator has taken a lot of time to load the application so I run clear.bat do fast Simulator. But after I run clear.bat. The values of what I stored in the persistent object had disappeared. Someone at - he said, therefore, it is the persistent object data are parties to cause of the performer, the clear.bat or any other reason. pls clarify my doubt friends...

    Kind regards

    s.Kumaran.

    It is b'caz of clean.bat. Clean.bat will remove all applications and unnecessary files, etc...

  • Problem on persistent object.

    Hi friends,

    My Simulator take a long time to load a program I m using the jde4.5 version. If we run clear.bat then we can accelerate simulator but I store an object any on the persistent object. It is persistent any object data erase if I run clear.bat?... is there another way to save the persistent object and make our quick Simulator to load the program. M pls kindly help.

    Kind regards

    s.Kumaran.

    Yes, clean.bat also erases store persistent Simulator (it stored in the *.dmp file).

    But clean.bat takes a long time to run, because it removes all the additional files of the Simulator file system.

  • The BlackBerry object Handles and the persistent object Handles?

    Can someone please what are the object Handles and handles of object persistent in Blackberry? and how are they different?

    Object handles are pointers to a Java object.  Each object that you create in your application using one of them.  Similarly, each object stored in the persistent store contains a handful.

    If you have a complex object you want to store in the persistent store, as a vector that contains a number of complex classes, you can store the vector in a group of objects that you want to save the object handles.  Grouped objects use a single Treaty when it is stored in the persistent store.  The disadvantage is to ungroup the object for editing.

    You will need to balance saving handles object against the drop in performance of separate objects.  Object groups are ideal for the complex elements that are frequently changed.

  • Several persistent object

    Hi guys,.

    I am a new blackberry applications developer.  I am working on an app I need to store

    First of all:

    username (String)

    password (String)

    user (String) token

    Then I need to store travel information based on the user's token. Travel information contains a lot of vectors

    such as:

    Names of travel (Vector)

    Locator (vectors) travel

    ....

    I am able to stor channels without any problem in store it and retrieve it without any problem. I have problems storing vectors. This is my persistent class:

    class StoreUserInfo implements Persistable
    {
    private vector _elements;
    public static final int UserEmail = 0;
    public static final int UserPass = 1;
    public static final int UserToken = 2;
     
        Private vector _Trip_Locators; is it good?

    public StoreUserInfo()
    {
    _elements = new Vector (3);
    for (int i = 0; i)< _elements.capacity();="">
    {
    _elements. AddElement (new String(""));
    }
            
             _Trip_Locators = new Vector();  ////
    }
        
    public String getElement (int id)
    {
    Return (String) _elements.elementAt (id);
    }
        
    ' Public Sub setElement (int id, String value)
    {
    _elements.setElementAt (value, id);
    }
        
        public Vector getTripLocator()
    {
    Vector temp = new Vector();
    for (int j = 0; j)< _trip_locators.capacity();="">
    {
    temp.addElement (_Trip_Locators.elementAt (j));
    }
    Return (Vector) temp;
    }
        
        
    public void setTripLocator (String addValue)
    {
    _Trip_Locators.addElement (AddValue);
    }

       
     
    }

    Here's how to store information:


    synchronized (storeUser)
    {
    If (storeUser.getContents () is nothing)
    {
    storeUser.setContents (new Vector());
    storeUser.commit ();
    }
               
    UserInfoData = new Vector();
    UserInfoData = storeUser.getContents ((vector));
                        
    StoreUserInfo info = new StoreUserInfo();
    info.setElement (StoreUserInfo.UserEmail, UName);
    info.setElement (StoreUserInfo.UserPass, PWord);
    info.setElement (StoreUserInfo.UserToken, UserReceivedToken);
                        
    UserInfoData.addElement (info);
    storeUser.setContents (UserInfoData);
    storeUser.commit ();

    }

    and here's how to get the information stored:

    Synchronized (storeUserSaved)
    {
    If (storeUserSaved.getContents () is nothing)
    {
    storeUserSaved.setContents (new Vector());
    storeUserSaved.commit ();
    }
             
    SavedData = new Vector();
    SavedData = storeUserSaved.getContents ((vector));
             
             
    If (!.) SavedData.isEmpty ())
    {
    Info StoreUserInfo = (StoreUserInfo) SavedData.lastElement ();
    Political = info.getElement (StoreUserInfo.UserEmail);
    pass = info.getElement (StoreUserInfo.UserPass);
    sentUserToken = info.getElement (StoreUserInfo.UserToken);

    These work very well. However, I want to know how to store several objects (Vector) as unique user name.

    Could someone help me with this? I browsed the forum and I found similar posts, but still I can not solve this problem.

    Thanks in advance guys.

    Shan

    You can store a vector in the store persistent as long as all classes stored in the vector to implement the persistable interface.

    Can you elaborate on the problem that you are experiencing?  Is an error or an exception thrown?  If so, what is it?

  • Size of the memory or the size of the persistent object

    Hi guys,.

    Anyone know the size of the object or the enduring memory... How we can store the data in this and if insert us more data it affects speed racing application?...

    Thank you

    PAPI M

    Since the same link you mentioned, here is the response from Mark Sohm:

    This value is very obsolete.  The maximum value of 64 k is back at the time 4.0.x.  I have the document updated.  The maximum current is the mega multi byte order.

    Rab

  • problem when getting the value of the persistent object

    Hello

    I am trying to store the State of registration of the user in my App I have used persistent store. But I don't get the bak of the store database. I wrote the code below:

    package com.saiservices.util;
    
    import java.util.Enumeration;
    
    import com.saiservices.ui.Logger;
    
    import net.rim.device.api.system.PersistentObject;
    import net.rim.device.api.system.PersistentStore;
    import net.rim.device.api.util.Persistable;
    
    public class SaiPersistentStore implements Persistable{
    
        private SaiHashTable mElements = null;
        static SaiPersistentStore instance;
        private static final long KEY = xxxxxxxxxxxx;
        private PersistentObject persistentObject = null;
    
        /**
         * Gets the single instance of DataBase.
         *
         * @return single instance of DataBase
         */
        public static SaiPersistentStore getInstance() {
            try {
                if (instance == null) {
                    instance = new SaiPersistentStore();
                }
            } catch (Exception e) {
                instance = null;
            }
            return instance;
        }
    
        private SaiPersistentStore()
        {
             Logger.out("PersistentStoreInfo", "inside constructor  ");
            persistentObject = PersistentStore.getPersistentObject(KEY);
             synchronized (persistentObject)
               {
                   if (persistentObject.getContents() == null)
                   {
                       persistentObject.setContents(new SaiHashTable());
                       persistentObject.commit();
                   }
               }
    
             mElements = (SaiHashTable)persistentObject.getContents();
             if (mElements == null){
                 Logger.out("PersistentStoreInfo", "************"+(mElements == null));
                 mElements = new SaiHashTable();
             }
        }
    
        public String getElement(String key)
        {
            Logger.out("PersistentStoreInfo", "getElement :"+key);
            Logger.out("PersistentStoreInfo", "getElement value   :"+mElements.get(key));
    
            return (String) mElements.get(key);
        }
    
        public void setElement(String key, String value)
        {
            Logger.out("PersistentStoreInfo", "setElement11111 :"+key + "   "+value);
            mElements.put(key, value);
            persistentObject.setContents(mElements);
            Logger.out("PersistentStoreInfo", "setElement22222 :"+key+"   "+value);
            persistentObject.commit();
        }
    
        public Enumeration getAllKeys()
        {
            return mElements.keys();
        }
    
    }
    

    And here's the code for hash table:

    package com.saiservices.util;
    
    import java.util.Hashtable;
    
    import net.rim.device.api.util.Persistable;
    
    public class SaiHashTable extends Hashtable implements Persistable{
    
        public SaiHashTable(){
            super();
        }
        public SaiHashTable(int initialCepacity){
            super(initialCepacity);
        }
    
    }
    

    Now, I'll put the element as follows:

    SaiPersistentStore.getInstance (.setElement("Registration","on"));

    But when I try to get the item in a way theis, gettting null value:

    SaiPersistentStore.getInstance () .getElement ("Register")

    Where I am doing wrong here?

    The fixed. Key hash table was different. Change it and it works...

  • Workaround for storing persistent objects I have persistent storage?

    I am storing configuration of sorts data in the persistent storage XML definitions and other data of type string.

    These data are read from a server when the application is installed and can also be requested by the user.

    It is stored in a hash table for the simple extraction and hash tables are saved in persistent storage, works well.

    Except for storing images that come in the format of png og files are not persistables. Who discovered the way lasts :-)

    Is there a way around this problem? All this data is delivered in a zip file from the server and everything is unpacked on the SD card. So is it possible to "turn" or "wrap" these png files so they can be stored in a persistent storage? Save them on the SD card are ok for temporary storage, but for 'permanent' storage, I like to keep in a persistent storage.

    arrays of bytes must be persistent.
    You can use http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/system/EncodedImage.html#getDa... to get bytes from an image, and you have already mentioned how to get it back.

    store in sqllite work similar.

  • Persistent object Null pointer exception

    Hi all! This is my first time that you try to use persisted data and, as a result of the Bberry tutorial, I'm a JVM 104 "NullPointer Exception" when you try to synchronize and "setContents' in a new Bank persistence (so basically my"PersistentObject"is Null (as confirmed by the debug), which I suppose that logic since I have not stored all the data it again.) I guess I'm just curious as to why I get this error (and cannot just write something on the value "null"). Here is a code...

    public static PersistentObject levels = PersistentStore.getPersistentObject (0x3e1f605d47578703L);

    ...

    String [] level_info = {'0', '1'}; just to test

    Synchronized (levels) {//this is where I get the error of debugging of "NullPoint Exception", where levels = "null"

    levels.setContents (level_info);
    Levels.Commit ();

    }

    Thank you in advance for your help!

    I solved the problem by displaying the 4.6 JDE 'samples' tutorial persistentstoredemo...

    You can find it here on your PC:

    C:\Program search in Motion\BlackBerry JDE 4.6.0\samples\com\rim\samples\device\persistentstoredemo

    Thank you

    -Jordan

  • How to generate keys for persistent object?

    How these keys are generated?

    PersistentStore.getPersistentObject (0xa1a569278238dad2L);

    Create a string like:

    com.foo.myFoobar.store

    The highlight in the JDE Editor, right click, and select "convert long."

  • Editing an object that I stored in the persistent store

    I store a custom object in the store persistent and would like to add a new Member.  Someone knows how can I do this?  I'd rather not delete it and store an object in its place because what happens if I need to add more members in the future.  This would encourage me to juggle all versions of my object.  Is there a kind of model for version control that I can apply to my objects stored persistently?

    I don't think it will work.  The link that you say talk us too much serialization, but the persistent object is not serialized as part of persistence.  If you want to serialize her, you should do it yourself.

    I'm guessing that you did not design your class being "expandable". And I'm guessing that you do not want your users to have to recreate these data.

    So I investigate an approach to migration.  In the code that gets the persistent store, got it get the object persistent, then check that it is indeed a picture of your old items.  If it is, convert it to an object type, store it in a collection (vector or Hashtable as suggested, for example) and keep the result, by replacing your old array of persistent storage object.  So your new application includes the old class of objects, exactly as it was, which means that you can install it on top of your existing application.  But once your request is used at the same time, the old persistent object is no longer used.

    Does make sense?

Maybe you are looking for

  • Computer won't be starting until... NTLDR

    I was trying to make room on my computer (it is a HP Pavilion 750n) and thought that I only deleted normal things like word documents, but when I rebooted, I realized that I must have deleted more than I thought... Now, I push the power button, and i

  • Qosmio G20: How to format the HARD drive?

    Hello! I bought Qosmio G20 last week and now I want to install Windows XP MCE (not recovery, but a CD in Windows XP CD) on this subject but I have a problem formatting of hard drives. There are two hard disks, and when I try to put in the form of Win

  • Problems of the system restore on Satellite L500

    Recovery disc Toshiba product to retrieve the system on the new hard drive in Toshiba L500 PSLS3A - 04M 002. During recovery, Windows has complained of "Windows cannot verify the digital signature for this file" - file is LPCFilter.sys. Also when you

  • Pavilion G6-2239dx: power on password - how can I get rid of it

    Somehow, I put a Sign On password. I know what it is, but I don't want to go up more. Can I get rid of him? I don't know how to get to the CMOS/RTC battery (don't want to break anything). I tried to install Windows 7, but the system has always said t

  • WebCenter + Ant

    HelloMy project is about WebCenter Application Portal Framework 11.1.1.8 and I am trying to create a compilation using ANT script to build the EAR file. Based on newspapers, it seems that the MAR file is not generated and cause failure.Can someone te