Instance Field Values LostI set the value of an instance field in a session bean but the value gets lost. Only stateful session beans maintain the values of their instance fields for a particular client. The container doesn't stop you from declaring instance fields in a stateless session bean because they're useful in managing resources used by all clients . However, manipulating the instance fields with client-specific data in the business methods can lead to unpredictable results. Subsequent calls by a client to a component interface reference for a stateless session bean can be serviced by a different bean instance, so there's no guarantee that the instance field values will be available. If you need to maintain client-specific data in a bean across method calls, use a stateful session bean. If you're having this problem with a stateful bean, make sure you aren't using transient fields for this instance field. The values of a transient field are lost if the instance is ever passivated. create Method Declaration ErrorsI get errors related to the declaration of stateless session bean create methods. A stateless session bean can declare only a single create method and that method must not accept any arguments. This is because you can't pass any client-specific initialization data to a stateless bean. The option to declare multiple create methods is valid only for stateful session beans. |