I am new to EJBs and recently started working on EJBs (3.0). I have been using Java for 6 years but never worked with EJB's before. I am overwhelmed with the complexity of the whole EJB business to say the least. I fail to understand where I can practically apply some of the concepts.
One question which comes to my mind after understanding the Stateless session bean is, Can you not always replace a stateless session bean with a shared instance of a class with no local members (effectively making it stateless)? I read about instance pooling being done for stateless session beans. If there is no state, can you not simply use one instance?
I am deploying my samples on OpenEJB and one place where I had to use stateless session bean was to interact with the EntityManager. I am not sure if I can get handle to the EntityManager in an arbitrary class. Apart from that, still puzzled what problem stateless session bean tries to solve.