原来configure()默认会在classpath下面寻找hibernate.cfg.xml文件,如果没有找到该文件,系统会打印信息并且抛出HibernateException异常。
不使用configure()方法也可以Configuration cfg=Configuration();这时在classpath下面寻找hibernate.properties文件,如果没有找到该文件,系统会打印信息并抛出HibernateException异常。
原来configure()默认会在classpath下面寻找hibernate.cfg.xml文件,如果没有找到该文件,系统会打印信息并且抛出HibernateException异常。
不使用configure()方法也可以Configuration cfg=Configuration();这时在classpath下面寻找hibernate.properties文件,如果没有找到该文件,系统会打印信息并抛出HibernateException异常。
转载于:https://my.oschina.net/xiaolaoshu/blog/640214