Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static final SessionFactory ourSessionFactory;
- final Session session;
- static {
- try {
- Configuration configuration = new Configuration();
- configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
- configuration.configure();
- ourSessionFactory = configuration.buildSessionFactory();
- } catch (Throwable ex) {
- throw new ExceptionInInitializerError(ex);
- }
- }
- public static Session getSession() throws HibernateException {
- return ourSessionFactory.openSession();
- }
- public DataModule() {
- session = getSession();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement