diff --git a/pom.xml b/pom.xml
index 1108fcc..5d9166f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -282,6 +282,11 @@
hibernate-core
3.6.10.Final
+
+ org.hibernate
+ hibernate-c3p0
+ 3.6.10.Final
+
com.googlecode.json-simple
json-simple
diff --git a/src/main/filtered-resources/WEB-INF/classes/hibernate.cfg.xml b/src/main/filtered-resources/WEB-INF/classes/hibernate.cfg.xml
index 8929c62..029846f 100644
--- a/src/main/filtered-resources/WEB-INF/classes/hibernate.cfg.xml
+++ b/src/main/filtered-resources/WEB-INF/classes/hibernate.cfg.xml
@@ -18,6 +18,12 @@
${hibernate.sql.show}
${hibernate.sql.format}
+ 5
+ 20
+ 300
+ 50
+ 10
+
diff --git a/src/main/java/net/socialgamer/cah/CahModule.java b/src/main/java/net/socialgamer/cah/CahModule.java
index 0f4ea7b..938c48d 100644
--- a/src/main/java/net/socialgamer/cah/CahModule.java
+++ b/src/main/java/net/socialgamer/cah/CahModule.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2012-2017, Andy Janata
+ * Copyright (c) 2012-2018, Andy Janata
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
@@ -37,13 +37,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.servlet.ServletContext;
-import net.socialgamer.cah.data.GameManager;
-import net.socialgamer.cah.data.GameManager.GameId;
-import net.socialgamer.cah.data.GameManager.MaxGames;
-import net.socialgamer.cah.data.User;
-import net.socialgamer.cah.metrics.Metrics;
-import net.socialgamer.cah.metrics.UniqueIds;
-
+import org.apache.log4j.Logger;
import org.hibernate.Session;
import com.google.inject.AbstractModule;
@@ -52,6 +46,13 @@ import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
import com.google.inject.assistedinject.FactoryModuleBuilder;
+import net.socialgamer.cah.data.GameManager;
+import net.socialgamer.cah.data.GameManager.GameId;
+import net.socialgamer.cah.data.GameManager.MaxGames;
+import net.socialgamer.cah.data.User;
+import net.socialgamer.cah.metrics.Metrics;
+import net.socialgamer.cah.metrics.UniqueIds;
+
/**
* CAH Guice module.
@@ -60,7 +61,9 @@ import com.google.inject.assistedinject.FactoryModuleBuilder;
*/
public class CahModule extends AbstractModule {
- private final static Properties properties = new Properties();
+ private static final Logger LOG = Logger.getLogger(CahModule.class);
+
+ private final Properties properties = new Properties();
private final ServletContext context;
@@ -179,7 +182,11 @@ public class CahModule extends AbstractModule {
*/
@Provides
Session provideHibernateSession() {
- return HibernateUtil.instance.sessionFactory.openSession();
+ final Session session = HibernateUtil.instance.sessionFactory.openSession();
+ if (!session.isConnected()) {
+ LOG.error("Session disconnected!");
+ }
+ return session;
}
@BindingAnnotation