2 Replies Latest reply on Feb 27, 2004 9:16 PM by Alex

    Hibernate - JNDI - Lookup

    getagrip Newbie

      Hi,
      1) I set up a hibernate.sar file with an appropriate MBean because

      2) I did not want to use the "traditional hibernate.cfg.xml or
      hibernate.properties method" as the JBoss documentation stated.

      3) In another part of the documentation it says that "For use inside
      an application server, Hibernate may obtain connections
      from a javax.sql.Datasource registered in JNDI."

      4) So I added the following to my code:

      props.put("hibernate.connection.datasource","java:/DefaultDS");
      sessionFactory = new Configuration().addProperties(props).configure().buildSessionFactory();

      5) But whenever I try to receive a sessionFactory the app throws the following Exception:
      Exception building SessionFactory: /hibernate.cfg.xml not found.
      I thought going the "MBean way" you could skip part 2)?
      Please help!