Spring Mvc | With Hibernate Example

@GetMapping("/showForm") public String showFormForAdd(Model model) { model.addAttribute("user", new User()); return "user-form"; }

@GetMapping("/list") public String listUsers(Model model) { List<User> users = userService.getAllUsers(); model.addAttribute("users", users); return "user-list"; } spring mvc with hibernate example

@Override public User getUserById(Long id) { Session session = sessionFactory.getCurrentSession(); return session.get(User.class, id); } users = userService.getAllUsers()