Using automatic persistence

To use automatic persistence, you must define a state datatype to hold your component’s instance state, implement accessor methods, and choose a storage component.

StepsConfiguring a stateful component to use automatic persistence

  1. Display the component’s properties, then click the Persistence tab. Configure the Persistence/General tab settings as follows:

    Setting

    Value

    Persistence

    Choose Automatic Persistent State.

    State

    Enter the name of an IDL structure that contains your component’s state data, for example:

    TheCart::CartState
    

    “Defining the IDL state type” describes how to create this structure.

    State methods

    Enter the names of the component methods that retrieve and apply an instance’s state data. If you specify no value, the default is getState,setState. Your component implementation must contain these methods, but they should not be listed in the component’s client interfaces. “Accessing the state data in the implementation” describes how to implement these methods.

    Storage component

    Specify the name of the storage component, as described in “Storage components”.

    Connection cache

    If using database storage, enter the name of a JDBC connection cache that connects to the database. The cache must have by-name access enabled.

    Table

    If using database storage, enter the name of a database table where the serialized data is to be stored. If you use Sybase Adaptive Server Enterprise or Adaptive Server Anywhere, EAServer creates the table if it does not exist. When using another data server, you or your database administrator (DBA) must create the table manually. The table must have the schema described in “Table schema for binary storage”.

  2. Define the IDL state type as described below.

  3. Add code to retrieve, apply, and modify the state data as described below.

  4. Regenerate stubs and skeletons for the component—this step will generate the Java classes for the IDL state types.

  5. If using in-memory storage, configure the component’s Mirror Cache properties and cluster to support in-memory failover, as described in “Requirements for in-memory stateful failover”.