replace SessionImplementor.getFactory() by Session.getSessionFactory()