Browse Source

quick and dirty test indicates that both connection pools work. verify tests will follow.

Mike Megally 9 years ago
parent
commit
5bfb14189c

+ 2 - 2
frameworks/Java/undertow-jersey-c3p0/pom.xml

@@ -56,12 +56,12 @@
     <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-core</artifactId>
-      <version>4.2.1.Final</version>
+      <version>4.3.11.Final</version>
     </dependency>
     <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-c3p0</artifactId>
-      <version>4.2.1.Final</version>
+      <version>4.3.11.Final</version>
     </dependency>
 
     <dependency>

+ 3 - 3
frameworks/Java/undertow-jersey-hikaricp/pom.xml

@@ -56,12 +56,12 @@
     <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-core</artifactId>
-      <version>4.2.1.Final</version>
+      <version>4.3.11.Final</version>
     </dependency>
     <dependency>
       <groupId>org.hibernate</groupId>
-      <artifactId>hibernate-c3p0</artifactId>
-      <version>4.2.1.Final</version>
+      <artifactId>hibernate-hikaricp</artifactId>
+      <version>4.3.11.Final</version>
     </dependency>
 
     <dependency>

+ 2 - 2
frameworks/Java/undertow-jersey-hikaricp/src/main/java/hello/SessionFactoryProvider.java

@@ -24,11 +24,11 @@ public class SessionFactoryProvider
   public SessionFactory provide()
   {
     Configuration configuration = new Configuration().configure();
-    String url = configuration.getProperty("hibernate.connection.url");
+    String url = configuration.getProperty("hibernate.hikari.dataSource.url");
     url = url.replace("//localhost:3306/",
         "//" + this.application.getProperties().get("dbhost") + ":"
             + this.application.getProperties().get("dbport") + "/");
-    configuration.setProperty("hibernate.connection.url", url);
+    configuration.setProperty("hibernate.hikari.dataSource.url", url);
     configuration.addAnnotatedClass(World.class);
     configuration.addAnnotatedClass(Fortune.class);
     ServiceRegistryBuilder serviceRegistryBuilder = new ServiceRegistryBuilder().applySettings(

+ 8 - 9
frameworks/Java/undertow-jersey-hikaricp/src/main/resources/hibernate.cfg.xml

@@ -1,17 +1,16 @@
 <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
 <hibernate-configuration>
   <session-factory>
-    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
-    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hello_world?jdbcCompliantTruncation=false&amp;elideSetAutoCommits=true&amp;useLocalSessionState=true&amp;cachePrepStmts=true&amp;cacheCallableStmts=true&amp;alwaysSendSetIsolation=false&amp;prepStmtCacheSize=4096&amp;cacheServerConfiguration=true&amp;prepStmtCacheSqlLimit=2048&amp;zeroDateTimeBehavior=convertToNull&amp;traceProtocol=false&amp;useUnbufferedInput=false&amp;useReadAheadInput=false&amp;maintainTimeStats=false&amp;useServerPrepStmts&amp;cacheRSMetadata=true</property>
-    <property name="hibernate.connection.username">benchmarkdbuser</property>
-    <property name="hibernate.connection.password">benchmarkdbpass</property>
+    <property name="hibernate.connection.provider_class">org.hibernate.hikaricp.internal.HikariCPConnectionProvider</property>
     <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
     <property name="hibernate.cache.use_query_cache">false</property>
-    <property name="hibernate.c3p0.min_size">256</property>
-    <property name="hibernate.c3p0.max_size">256</property>
-    <property name="hibernate.c3p0.timeout">1800</property>
-    <property name="hibernate.c3p0.max_statements">2048</property>
     <property name="hibernate.show_sql">false</property>
-    <property name="hibernate.format_sql">false</property>
+    <property name="hibernate.hikari.minimumIdle">256</property>
+    <property name="hibernate.hikari.maximumPoolSize">256</property>
+    <property name="hibernate.hikari.idleTimeout">30000</property>
+    <property name="hibernate.hikari.dataSourceClassName">com.mysql.jdbc.jdbc2.optional.MysqlDataSource</property>
+    <property name="hibernate.hikari.dataSource.url">jdbc:mysql://localhost:3306/hello_world?jdbcCompliantTruncation=false&amp;elideSetAutoCommits=true&amp;useLocalSessionState=true&amp;cachePrepStmts=true&amp;cacheCallableStmts=true&amp;alwaysSendSetIsolation=false&amp;prepStmtCacheSize=4096&amp;cacheServerConfiguration=true&amp;prepStmtCacheSqlLimit=2048&amp;zeroDateTimeBehavior=convertToNull&amp;traceProtocol=false&amp;useUnbufferedInput=false&amp;useReadAheadInput=false&amp;maintainTimeStats=false&amp;useServerPrepStmts&amp;cacheRSMetadata=true</property>
+    <property name="hibernate.hikari.dataSource.user">benchmarkdbuser</property>
+    <property name="hibernate.hikari.dataSource.password">benchmarkdbpass</property>
   </session-factory>
 </hibernate-configuration>