| Author |
isIdentical understanding
|
Chetan Sahasrabudhe
Ranch Hand
Joined: Aug 09, 2004
Posts: 75
|
|
Because stateless session beans have the same object identity, the isIdentical method always returns true when used to compare them. I am not able to understand what does same object identity means ? Please help
|
Thanks & Regards<br />Chetan
|
 |
KasiMurugan Ramasamy
Ranch Hand
Joined: Jan 30, 2005
Posts: 125
|
|
For stateless bean, we know all the session bean instances are same which are created in a containere. That is the reason isIdentical() method returns always returns true. Regards Kasimurugan R
|
Thanks & Regards
Kasimurugan (SCJP1.4, SCBCD1.3), Preparing SCWCD1.4
|
 |
Chetan Sahasrabudhe
Ranch Hand
Joined: Aug 09, 2004
Posts: 75
|
|
Kasimurugan Thanks for the information. I guess stateless sesson bean idealy should not have any class attributes.
|
 |
Gustavo Dutra
Greenhorn
Joined: Jan 26, 2005
Posts: 22
|
|
Dear friends, On page 141 of the Head First EJB book the author says the isIdentical() method return TRUE for stateless beans when they are create from the same HOME, if you make a new deploy and get another home, the isIdentical will return false, if compared with the beans created from the older Home. The example on the specification use the same home object, but did not say anything about this. We can research.... :-)
|
 |
Binoj Viswanathan
Ranch Hand
Joined: Feb 25, 2003
Posts: 85
|
|
hi, i have tested this... i created one SLSB and deployed twice with 2 difrent jndi names.Then i created 3 home objects. 2 with from same jndi context and 1 from 2nd jndi context. then i compard(using isIdentical) the ejbObjs from the 1st two.it returnd me true (and it shud). then i campard 1st and 3rd ejbObj(both r deplod with 2 difrent jndi context but of same type). it also returned me true!!! i also red frm the HFEJB that if u deployed twice , it wil return false..... something quizzzy.... binoj
|
SCJP 1.4(98%)<br />SCBCD1.3 (100%)<br />SCWCD 1.4 (93%)(w/o prep..n)
|
 |
Binoj Viswanathan
Ranch Hand
Joined: Feb 25, 2003
Posts: 85
|
|
hi, also in spec, it says, the container will keep same obj identity for all bean instances from same home type.(P66) so isIdentical() shud return true even if it deployed twice and using from ejbObj from each one. binoj
|
 |
 |
|
|
subject: isIdentical understanding
|
|
|