load hibernate.cfg.xml in existing java project

后端 未结 3 875
独厮守ぢ
独厮守ぢ 2021-01-26 05:55

I try to load hibernate.cfg.xml in a submodule (ssf/samples/customcontroller) of an existing project. For this project there exists a build.xml which builds and deploys the proj

3条回答
  •  生来不讨喜
    2021-01-26 06:56

    HI try to pass hibernate.cfg.xml file path as an argument into the configure()

    SessionFactory sessionFactory = new Configuration().configure(
                        "/ssf/samples/customcontroller/src/resources/hibernate.cfg.xml")
                        .buildSessionFactory();
    
                return sessionFactory;
    

提交回复
热议问题