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());
} }