• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Stateless beans - isIdentical()

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Keerthi.
reply
    Bookmark Topic Watch Topic
  • New Topic