• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about multiple instances of same ejb..

 
Bob Walker Jr
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?
 
Jianming Wang
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Certainly you can.
 
Bob Simpson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can. With different JNDI names.
 
Rangarajan Suresh
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic