• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJBHomeFactory and Stateless Session Bean  RSS feed

 
ShengTa Tsai
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i read about EJBHomeFactory pattern, i come up with a thought about Stateless SessionBean. According to EJB 2.0 spec(p66), the same EJBHome object will create the same "stateless" SessionBean. If two clients request homefactory to get the home interface which is stateless SessionBean, the two clients will get the same stateless session bean. Will this be a problem when multi-accession to the same stateless SessionBean?
 
Sergiu Truta
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are using the EJBHomeFactory in pretty large projects and we are also using Session beans but we never had a problem such as the one suggested by you. I am not really sure though that both clients use the same bean. Let's see what the gurus have to say
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No two clients use the same stateless session bean even though they would acquire the reference through the exact same home reference.
 
ShengTa Tsai
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't agree with you anymore about No two client will use the same stateless bean. But the spec did show that the same home interface reference will create the same stateless session bean(p.66).
If homeFactory caches the home reference, it is supposed to be every client will get the same stateless session bean.
How could we explain this situation is what i want to understand.
 
Sergiu Truta
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's true that each client gets the same home interface from the EJBHomeFactory but this home creates different EJBObjects for different clients. If you want you can see the home interface as a factory for EJBObjects. It's purpose is to create/find/destroy EJBOBjects and it exists because through it the clients aquire references to EJBObjects.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!