• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how many EJBObjects

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
abc.create("123");
abc.create("456");
and so on....
Would there be an EJBObject created for each invocation of create() method or would there be only one instance.
Regards
sanj
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic