最好只创建一个呢?
解决方案 »
- 图片放大功能,当我点击top页面的超链接的时候,页面会自动跳到新选项卡中,如果去掉放大功能则不会
- 请问hibernate.cfg.xml配置问题
- struts2能不能在拦截器中获取struts.xml中包的名称?
- 访问网页时迅雷是怎么启动的?
- 请教,关于struts用户登录问题
- 如题:现在javaWEB开发的薪水在一个什么样子的范围?
- 100分相送!在JBuilder中如何单步调试JSP+JAVABEAN?
- jsp+access,简单的问题,小女子在这里谢谢各位ggjj了
- 一个简单jsp的登陆程序未搞定,请帮我看看
- jsp界面如下,后台代码该如何实现;大神们帮帮忙吧!!!!
- JQuery出错
- 为什么我的servlet 文件夹过滤器web.xml中的配置参数传不进去呢
sessionFactory 就一个啊,只不过上它可以打开多个 session 啊 ..
如果是一个得话,就没有必要多个相同的了。
private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";
private static final ThreadLocal threadLocal = new ThreadLocal();
private static Configuration configuration = new Configuration();
private static org.hibernate.SessionFactory sessionFactory;
private static String configFile = CONFIG_FILE_LOCATION; static {
try {
configuration.configure(configFile);
sessionFactory = configuration.buildSessionFactory();
} catch (Exception e) {
System.err
.println("%%%% Error Creating SessionFactory %%%%");
e.printStackTrace();
}
}
[b]private HibernateSessionFactory() {
}[/b]
............