public void contextInitialized(ServletContextEvent event) {
try {
ServletContext context = event.getServletContext(); String hibernateFile=com.app.util.Normal.parse(context.getInitParameter("hibernateConfigLocation"));
Configuration cfg = new Configuration().configure(new java.io.File(context.getRealPath(hibernateFile)));
//dialect = cfg.getProperty(net.sf.hibernate.cfg.Environment.DIALECT); //这里就是你需要的,其他的各个都跟这个相似
sessionFactory = cfg.buildSessionFactory();
System.out.println(
"Create hibernate pool connection successfully.");
} catch (HibernateException ex) {
System.out.println(
"Create hibernate pool connection failure." + ex.toString());
} }
try {
ServletContext context = event.getServletContext(); String hibernateFile=com.app.util.Normal.parse(context.getInitParameter("hibernateConfigLocation"));
Configuration cfg = new Configuration().configure(new java.io.File(context.getRealPath(hibernateFile)));
//dialect = cfg.getProperty(net.sf.hibernate.cfg.Environment.DIALECT); //这里就是你需要的,其他的各个都跟这个相似
sessionFactory = cfg.buildSessionFactory();
System.out.println(
"Create hibernate pool connection successfully.");
} catch (HibernateException ex) {
System.out.println(
"Create hibernate pool connection failure." + ex.toString());
} }
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货