@@ -0,0 +1,960 @@
+package ru.job4j.todo.listener;%0A%0A%0Aimport org.hibernate.SessionFactory;%0Aimport org.hibernate.cfg.Configuration;%0A%0Aimport javax.servlet.ServletContextEvent;%0Aimport javax.servlet.ServletContextListener;%0Aimport javax.servlet.annotation.WebListener;%0Aimport javax.servlet.http.HttpSessionAttributeListener;%0Aimport javax.servlet.http.HttpSessionListener;%0A%0A@WebListener()%0Apublic class HibernateContextListener implements ServletContextListener,%0A        HttpSessionListener, HttpSessionAttributeListener %7B%0A%0A    /**%0A     * Session factory of Hibernate.%0A     */%0A    private SessionFactory sessionFactory;%0A%0A    @Override%0A    public void contextInitialized(ServletContextEvent sce) %7B%0A        this.sessionFactory = new Configuration().configure().buildSessionFactory();%0A        sce.getServletContext().setAttribute(%22sessionFactory%22, sessionFactory);%0A    %7D%0A%0A    @Override%0A    public void contextDestroyed(ServletContextEvent sce) %7B%0A        this.sessionFactory.close();%0A    %7D%0A%7D

Add HibernateContextListener.