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?
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
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.
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.