• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

isIdentical()  RSS feed

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does this always return false for stateful session beans? It may be possible that I have two stubs at client side(same client) reffering to same EJBObject on server side.
Or even two references to same stub?
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stateful session beans have a one to one relationship between clients and their component interface implementors (or EJBObject). Given this condition, no two instances of EJBObject can be the same.

HTH
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
For a stateful bean, the bean will maintain the conversational state of the client. Eventhough the bean comes from the same home, it will always return false.

Thanks and Regards,
Akila
 
Tejastejas Gokhale
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct. but what i am saying is same client can have two stubs to same EJBObject.or
it can have two references to same stub itself. Then in that case isIdentical should return true.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Tejas,

This is what the spec has to say....

The following example illustrates the use of the isIdentical method for a stateful session object.
FooHome fooHome = ...; // obtain home of a stateful session bean
Foo foo1 = fooHome.create(...);
Foo foo2 = fooHome.create(...);
if (foo1.isIdentical(foo1)) {// this test must return true
...
}
if (foo1.isIdentical(foo2)) {// this test must return false
...
}

Is the second stub (object) just a simple copy of the first? In that it will return TRUE.. no?

Regards,
tiro
 
Patrick Williams
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Is the second stub (object) just a simple copy of the first? In that it will return TRUE.. no?



No and No. EJB does not work like a Servlet would (meaning that it doesn't recognize inbound requests from the same client implicitely). Each call to create() would create another stateful session bean instance.

HTH
[ June 29, 2006: Message edited by: Patrick Williams ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!