GetResultList() in init-method giving error “session is closed”?

First of all your TestServiceImpl is not annotated with Transactional but even if it was, it wouldn't work, see: Transactional init-method and SPR-2740 which explains this is by design.

First of all your TestServiceImpl is not annotated with @Transactional, but even if it was, it wouldn't work, see: Transactional init-method and SPR-2740 - which explains this is by design. What you can do is to use init() method only to call some other bean's business method, which is marked @Transactional. Private TestDao testDao; public void init() { testDao.findAll(); } And in TestDao bean: private EntityManager entityManager; @Transactional public findAll() { Query query = entityManager.

CreateQuery("from myTable"); return query.getResultList(); }.

Thanks for the answer, calling some other bean's business method worked for, by the way I already had @Transactional on the service class(forget to put it in the question) but as you mentioned even if it was there it wouldn't have worked. – user908452 Oct 16 at 23:47.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions