Single shared stateful EJB isntance?
Status: Alpha
Brought to you by:
aananiev
Great work with this software package. It's extremely
useful to me in my work.
After associating a stateful EJB home to the context,
I get an error from attempting to create different
instances of the bean: it seems I'm always using the
same instance.
Since it should be possible to use different
instances representing different states for different
sessions, I suppose that this is a bug and not a
design.
Logged In: YES
user_id=387777
Could you post your code here so I can better understand
what you are trying to do. My basic test with multiple
instances of a stateful bean works fine:
String someState1 = "some state";
// create the bean
SampleStatefulService sampleStatefulService1 =
statefulSampleServiceHome.create( someState1);
// Call the bean and make sure that it returns the
same state
String returnedState1 =
sampleStatefulService1.getSampleState();
String someState2 = "some other state";
SampleStatefulService sampleStatefulService2 =
statefulSampleServiceHome.create( someState2);
// Call the bean and make sure that it returns the
same state
String returnedState2 =
sampleStatefulService2.getSampleState();
assertEquals( someState1, returnedState1 );
assertEquals( someState2, returnedState2 );
// remove the bean
sampleStatefulService1.remove();
sampleStatefulService2.remove();