Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP 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:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

isIdentical method for Stateless Session Bean

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In EJB Spec. 2.0, Section 6.9.2,

First paragraph (2nd line) says,
"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"

I really don't understand the above sentence.
If same SLSB is deployed multiple times, how can a client hold all the ejbobject references (one ejbobject per deployment basis).

Can anybody help me in understanding this ?
Thanks in advance.

Micheal
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let's say that the bean is deployed twice. A client can do two JNDI lookups to get the home interfaces and then get the componenent interface from each of the homes.
 
Micheal Jacob
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even if we deploy twice, at any point of time, there will be only one bean in container right ?

Is my understanding correct ?

Suppose say, i deploy first time,
i get objA as my remote reference.

Now i deploy second time, (by this time, already deployed bean is gone, right ?)
i get objB as my remote reference.


If i call objA.isIdentical(), will this not throw NoSuchObjectException ??

Micheal
 
Sheriff
Posts: 3036
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm ... I've never seen Michael spelled that way. Is it still pronounced like Michael?

I think you're confusing the session bean with its home stub. You retrieve the home from JNDI, and there is, in fact, only one ... unless you actually write your deployment descriptor to deploy the same bean type twice under two different JNDI names. That means two homes and two separate pools of the stateless session beans, just as if you had deployed two entirely different beans. The point the spec is making is that the two homes can't share a pool, so you can never retrieve the same session object from different homes.
 
Micheal Jacob
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm now i get the point.

If we deploy same session bean twice (both have different jndi home name)
(have two session element in DD)

though the bean is same, isIdentical will return false. (as they are not from same home)

Thanks roger & greg.
 
reply
    Bookmark Topic Watch Topic
  • New Topic