Defining the IDL state type

The IDL state type is a structure that must hold all the session data for the bean. The following IDL module shows example types used for a shopping cart component:

module TheCart
{
  // This is the state type, an IDL structure that holds customer data 
  // and the collection (sequence) of items in the cart.
  struct CartState
  {
    string name;
    string address;
    string phone;
    ::TheCart::ShoppingCartItems items;
  };

  // "ShoppingCartItems" is the sequence to hold items in the cart:
  typedef sequence < ::TestInMemoryFailvoer::ShoppingCartItem > ShoppingCartItems;

  // "ShoppingCartItem" holds the data for one item in the cart:
  struct ShoppingCartItem
  {
    string item;
    long quantity;
  }
}

In the State field on the Persistence/General tab, you can enter the name of an IDL structure that does not exist. EAServer Manager creates the structure when you close the Component Properties dialog box. Afterwards, navigate to the module definition under the top-level IDL folder and edit the structure definition. For information on editing IDL in EAServer Manager, see Chapter 5, “Defining Component Interfaces.”