Troubleshooting

Instance Field Values Lost

I 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 ...

Get Special Edition Using Enterprise JavaBeans™ 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.