Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. I 17:46:35.936 org.hibernate.cfg.Configuration doConfigure: HHH000041: Configured SessionFactory: null
  2. W 17:46:36.209 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure: HHH000402: Using Hibernate built-in connection pool (not for production use!)
  3. I 17:46:36.243 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure: HHH000115: Hibernate connection pool size: 0
  4. I 17:46:36.244 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure: HHH000006: Autocommit mode: false
  5. I 17:46:36.244 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure: HHH000401: using driver [com.mysql.jdbc.GoogleDriver] at URL [jdbc:google:mysql://database?user=someUser]
  6. I 17:46:36.245 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure: HHH000046: Connection properties: {}
  7. I 17:46:45.356 org.hibernate.dialect.Dialect <init>: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
  8.  
  9. properties.put("hibernate.connection.driver_class", "com.mysql.jdbc.GoogleDriver");
  10. properties.put("hibernate.connection.url", "jdbc:google:mysql://" + SQL_INSTANCE + "/" + DATABASE + "?user=someUser");
  11.  
  12. // disable schema check
  13. properties.put("hibernate.hbm2ddl.auto", ""); // disable
  14. properties.put("hibernate.show_sql", false);
  15.  
  16. // single session per request/thread
  17. properties.put("hibernate.connection.pool_size", 0);
  18. properties.put("hibernate.current_session_context_class", "thread");
  19.  
  20. Configuration cfg = new Configuration();
  21. cfg.configure("/META-INF/hibernate.cfg.xml");
  22. cfg.addProperties(properties);
  23.  
  24. sessionFactory = cfg.buildSessionFactory(new ServiceRegistryBuilder().applySettings(cfg.getProperties()).buildServiceRegistry());
  25.  
  26. public Session getSession() {
  27.  
  28. Session session;
  29. try {
  30. session = sessionFactory.getCurrentSession();
  31. }
  32. catch (org.hibernate.HibernateException he) {
  33. log.info("Opening new hibernate session.");
  34. session = sessionFactory.openSession();
  35. }
  36.  
  37. return session;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement