Hello forum, I've used HibernateTools in order to generate POJO classes and DAO (<pojoname>Home.java). So, Home files generated by HibernateTools are as follow -->
Code:
   private final SessionFactory sessionFactory = getSessionFactory();
   protected SessionFactory getSessionFactory() {
      try {
         return (SessionFactory) new InitialContext()
               .lookup("SessionFactory");
      } catch (Exception e) {
         log.error("Could not locate SessionFactory in JNDI", e);
         throw new IllegalStateException(
               "Could not locate SessionFactory in JNDI");
      }
   }
   public void persist(Role transientInstance) {
      log.debug("persisting Role instance");
      try {
         sessionFactory.getCurrentSession().persist(transientInstance);
         log.debug("persist successful");
      } catch (RuntimeException re) {
         log.error("persist failed", re);
         throw re;
      }
   }
So, getSessionFactory searchs SessionFactory JNDI name into initialContext. So, What on earth must I do to add a SessionFactory to JNDI resources in Tomcat cache?
What Must I do to solve it? Thanks