isIdentical

Question :- A client has two object references to a session bean's home interface. How can it find out whether the object references are accessing the same object?

I think answer will be

Using the isIdentical() method

But the given answer is References of the home interface of the same bean are always identical because there is only one instance of the Home interface. Means there is no need of isIdentical() method.

But as per my observation this will be right only if session bean is stateless isn't ?

Please share ur opinion

Roger Chung-Wee

Ranch Hand

Posts: 1683

posted 11 years ago

What is your reason for believing that there will be multiple home objects for session beans which are not stateless?

SCJP 1.4, SCWCD 1.3, SCBCD 1.3

Thomas Vezhambacheril

Greenhorn

Posts: 17

posted 11 years ago

suppose if it is stateful session bean ?

Thomas Vezhambacheril

Greenhorn

Posts: 17

posted 11 years ago

means stateful session beans reference returned from same home will be different while we are using isIdentical(). isn't?

Ed Marte

Greenhorn

Posts: 3

posted 11 years ago

Originally posted by Thomas Vezhambacheril: Question :- A client has two object references to a session bean's home interface. But the given answer is References of the home interface of the same bean are always identical because there is only one instance of the Home interface. Means there is no need of isIdentical() method.

You cannot call isIdentical method on home interface, because there's no such method in EJBHome interface, it's in EJBObject only.