Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

how many EJBObjects

Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
If I have a reference to the EJBHome interface as say..
ABCHome abc=null;
Now if I call the create()method thus..
and so on....
Would there be an EJBObject created for each invocation of create() method or would there be only one instance.
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it depends upon the type of EJB used.
If it is Statefull session bean it will
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
If this is stateless session bean second if will return true as it does not matter.
For Entity Beans
"If two entity objects have the same home and
the same primary key, they are considered identical."
"Alternatively, if a client obtains two entity object references from
the same home, it can determine if they refer to the same entity by comparing their primary keys using
the equals method."
So in your case if it is Entity beans object it two objects will be there.
Hey, I'm supposed to be the guide! Wait up! No fair! You have the tiny ad!
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic