} catch (ClassNotFoundException e) {
throw new RuntimeException("Cannot load specified JDBC driver: " + jdbcDriver, e);
}
DriverManagerDataSource dataSource=new DriverManagerDataSource(jdbcConnection, jdbcUser, jdbcPassword);
AnnotationSessionFactoryBean sessionFactoryBean = new AnnotationSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource);
Properties config = new Properties();
config.setProperty("hibernate.dialect", hibernateDialect);
config.setProperty("hibernate.connection.autocommit", "true");
config.setProperty("hibernate.hbm2ddl.auto", "update");
sessionFactoryBean.setHibernateProperties(config);
sessionFactoryBean.setAnnotatedClasses(new Class<?>[]{WarningRecord.class});
try {
sessionFactoryBean.afterPropertiesSet();
} catch (Exception e) {
throw new RuntimeException("Could not set up database connection", e);
}
hibernateTemplate = new HibernateTemplate((SessionFactory) sessionFactoryBean.getObject());
}