-
2008-05-16
How to load hibernate.cfg.xml
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://10313520.blogbus.com/logs/20981793.html
Loading of the hibernate.cfg.xml depends on how are you are calling "configuration.configure()" if you are not passing any parameter to .configure() method, then it would look for the file at WEB-INF/classes directory, means root of the classpath but if you want to pull out xml file from different location under same project then you can do something like "URL u = ClassLoader.getSystemResource(configFile);configuration.configure(u);" where configFile is a String object containing the location of the xml file.
-Girish---------------------------------------------------------------------------------------------
在tomcat安装目录中,建立一个独立的Web Context配置(webapps/quickstart)。我们确认全局库文件(tomcat/lib)和本web应用程序上下文路径(对于jar来说是webapps/quickstart/WEB-INF/lib,对于class文件来说是webapps/quickstart/WEB-INF/classes)能够被类装载器检索到。我们把这两个类装载器级别分别称为全局类路径(global classpath)和上下文类路径(context classpath)。
---------------------------------------------------------------------------------------------
以上分别节自http://www.myeclipseide.com/PNphpBB2-viewtopic-t-19599.html和hibernate reference中文参考手册。
待过段时间,全面总结,web.xml,server.xml,hibernate.cfg.xml,struts-config.xml.等相关配置文件。
随机文章:
关于Timer及Daemon Thread 2008-06-18Linux 文件命令精通指南(zt) 2008-06-17Java中文与字符编码--之乱七八糟 2008-06-13哈哈,无聊一篇 2008-05-28之前的一些(二)happens-before 2008-05-17
收藏到:Del.icio.us





