Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stateless beans - isIdentical()

 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

For stateless beans calling the isIdentical() method on the ejb objects from the same home returns true, fine.
If the bean is deployed twice two homes will be created(say Home1 and Home2 ) and now i got the two ejb objects one from each of the home ( Home1 and Home2), now if i call the isIdentical() method on these ejb objects - i will get false. Is it true ?
One of my doubt is, What is meant by deploying the same bean twice?
Another question is take the below code, ( for local client)

Context ctx = new InitialContext();

AccountHome home1 = (AccountHome)ctx.lookup("java:comp/env/AccountRef");
Account acct1 = home1.create();

AccountHome home2 = (AccountHome)ctx.lookup("java:comp/env/AccountRef");
Account acct2 = home2.create();

Now --> acct1.isIdentical(acct2) -- Will return true or false.


Thanks in Advance,
 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the JNDI name is the same, then you are NOT deploying the bean twice, but redeploying the same bean. The container will create only one home object. acct1.isIdentical(acct2) will then return true.
 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Keerthi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic