Originally posted by Arun Kumarr:
Well you can write it inside your stateless session bean. But, it depends on what other responsibilities you have given your session bean.
Does it do just the job of setting up the entity manager and calling the business methods and finshing off the work? or it has more responsibilities. Also depends on how many entity managers you use.
It does just that - creating EntityManagerFactory, EntityManager object and calling business methods. Not sure about the number of entity managers I will be required.
I suggest having a separate layer which does this and return after the job is done. Moreover, even if you want to replace the entire entity manager stuff and mange your objects(POJOS) all by yourself you can just replace it separately without any change in the session code (Mind you this is the client interface to the app running inside your server).
Okay. So what kind of layer it cab be??? Can't that code go in POJO and I call it from stateless session bean.
Also what made you ask the question that this should be written inside your POJO?
Actually I should have been more specific. I meant, the code should go in any of the implementation of DAO. And creating 'DAO Factory object' and 'DAO object' code can go in stateless session bean. Does this make sense?
Thanks a ton.