I'm just not getting it. I'm trying to learn SpringMVC, thought I was doing it correctly, but I keep getting a " Session is Closed" exception when I attempt to call a Repository object from a Controller object. Any enlightenment would be highly appreciated.
Code:**Repository public class UserServiceImpl implements UserService { **PersistenceContext private EntityManager entityManager; **SuppressWarnings("unchecked") public List<User> getUsers() { Query query = entityManager.createNamedQuery("User.findUsers"); return query.getResultList(); } }Code:**Controller public class WelcomeController { **Autowired (required = true) private UserService userService; **RequestMapping("/list2.do") public ModelMap getUsers() { List<User> users = userService.getUsers(); System.out.println("NUM USERS: " + users.size()); return null; } }
All my server side JUnit tests work as expected ... everything works but this
and the error is ...
org.springframework.orm.hibernate3.HibernateSystem Exception: Session is closed!; nested exception is org.hibernate.SessionException: Session is closed!
Help!


Reply With Quote
