org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [/HibernateTest/src/hibernate.cfg.xml]

前端 未结 6 709
故里飘歌
故里飘歌 2020-12-28 11:50

I am trying to connect to Postgresql9.1 in ubuntu with pgadmin3. My Pgadmin3 GUI tool does not give any option to create tables by right clicking the database, but it is ava

6条回答
  •  梦毁少年i
    2020-12-28 11:55

    new Configuration().configure() takes hibernate.cfg.xml from root of class path directory. new Configuration().configure("/com/company/project/hibernate.cfg.xml") takes from root of class path + com/company/project/hibernate.cfg.xml.

    If you are using different file name for hibernate configuration from root of class path, then eg: new Configuration().configure("/database.cfg.xml")

    If you want to give the full system path of the configuration file then new Configuration().configure(new File("/home/visruth/config/hibernate.cfg.xml)) which takes the configuration file from the given exact location.

提交回复
热议问题