Setting Persistence/General subtab properties

Display the Component Properties window in EAServer Manager and configure the following fields on the Persistence/General subtab:

Defining the state datatype

For automatic persistence, you must define a state datatype to be used for exchange of data between the component’s skeleton and the storage component.

State types for mapped fields If using the mapped-fields storage model, the state datatype must be an IDL structure. Enter the structure name in the in the State field on the Persistence/General subtab in the Component Properties Dialog box. For example:

MyPackage::CustomerState

You can enter the name of an IDL structure that does not exist; EAServer Manager creates it when you click Ok in the Component Properties dialog box. Afterwards, navigate to the IDL definition and edit the structure as described in “Editing IDL types, exceptions, and interfaces”.

Define the structure field names and types as follows:

State types for binary storage If you are using the binary storage model, enter the name of an IDL structure or serializable Java class. Your state accessor methods must contain code to get and set this data to and from the current instance, as described in “Defining the state methods”.

Defining the state methods

For automatic persistence in non-EJB components or in EJB components using the binary-storage persistence model, your component implementation must contain state accessor methods to read state data from the current instance and apply state data to the current instance. Specify the names of these methods on the State Methods field in the Persistence/General subtab. 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. The getState method returns an instance of the type specified by the State field, and the setState method accepts a parameter of this type. For example, if the State type is ShoppingCartState, the getState and setState methods might be defined as follows in Java:

private ShoppingCartState data;

ShoppingCartState getState()
{
    return data;
}

void setState(ShoppingCartState state)
{
    data = state;
}