I have this excerpt from the
EJB spec 2.0
Can some one explain me what is the difference.
Regards
steve
65 8/14/01
6.9.1 Stateful session beans
A stateful session object has a unique identity that is assigned by the container at create time.
A remote client can determine if two remote object references refer to the same session object by invoking
the isIdentical(EJBObject otherEJBObject) method on one of the references. A local
client can determine if two local object references refer to the same session object by invoking the
isIdentical(EJBLocalObject otherEJBLocalObject) method.
Client View of a Session Bean Enterprise JavaBeans 2.0, Final Release Object identity
Sun Microsystems, Inc.
The following example illustrates the use of the isIdentical method for a stateful session object.
FooHome fooHome = ...; // obtain home of a stateful session bean
Foo foo1 = fooHome.create(...);
Foo foo2 = fooHome.create(...);
if (foo1.isIdentical(foo1)) {// this
test must return true
...
}
if (foo1.isIdentical(foo2)) {// this test must return false
...
}
6.9.2 Stateless session beans
All session objects of the same stateless session bean within the same home have the same object identity,
which is assigned by the container. If a stateless session bean is deployed multiple times (each
deployment results in the creation of a distinct home), session objects from different homes will have a
different identity.
The isIdentical(EJBObject otherEJBObject) and isIdentical(EJBLocalObject
otherEJBLocalObject) methods always returns true when used to compare object references
of two session objects of the same stateless session bean.
The following example illustrates the use of the isIdentical method for a stateless session object.
FooHome fooHome = ...; // obtain home of a stateless session bean
Foo foo1 = fooHome.create();
Foo foo2 = fooHome.create();
if (foo1.isIdentical(foo1)) {// this test returns true
...
}
if (foo1.isIdentical(foo2)) {// this test returns true
...
}