Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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 ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

question about multiple instances of same ejb..  RSS feed

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we deploy the same enterprise bean multiple times in a container?
Like we have in servlets, we can deploy the same servlet class with different servlet-names. Can we do it with EJBs?
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Certainly you can.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can. With different JNDI names.
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But be careful, when you try to use isIdentical on these multiple deployments.
Find Excerpt from EJB2 spec below:

6.9.2 Stateless session beans
All session objects of the same stateless session bean within the same home have the same object iden-tity,
which is assigned by the container. If a stateless session bean is deployed multiple times (each
deployment results in the creation of a distinct home), session objects from different homes will have a
different identity.
The isIdentical(EJBObject otherEJBObject) and isIdentical(EJBLocalOb-ject
otherEJBLocalObject) methods always returns true when used to compare object refer-ences
of two session objects of the same stateless session bean.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!