• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

two object references to a session bean's home interface

 
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

Select 1 correct option.

1 Using the == operator.

2 Using the equals() method.

3 Using the isIdentical() method.

4 Using the isEqual() method.

5 Get the PrimaryKey for both and then use equals() method to compare the primary keys.

6 Get the PrimaryKey for both and then use isIdentical() method to compare the primary keys.

7 None of these.
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note, both are references to home object. So you cannot use isIdentical() method. Other options are invalid for session beans. My answer would be None of the above.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Keerthi,
I was thinking of the same answer when i had a look at your post. And, i am sure it is perfect..

But i have a related question.. So, if a client really has2 references to the same home object, he should pretty much be able to use *instanceof* operator... I am assuming this because, there is going to be only one home for a deployed bean type. Am i correct or am i missing something.
 
Keerthi P
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
instanceof operator can tell you whether a reference is referencing an object of a specified type. It cannot tell you if 2 references are referencing the same object. Moreover, the spec does not guarantee that there will be only one EJBHome object for each bean type.
 
Ganeshji Marwaha
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank u keerthi, was just curious.
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Keerthi,

I think the answer should be 1. You can compare 2 references using == . Am I missing something here?

Thanks
Deep
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic