Spring+Hibernate+Proxool配置

Spring+Hibernate+Proxool配置

Spring 2.0
Hibernate 3
Proxool 0.9RC1
 
如果用RC2会出错。
 
Spring配置入下:
<property name="hibernateProperties">
   <props>
    <prop key="hibernate.cglib.use_reflection_optimizer">
     ${hibernate.cglib.use_reflection_optimizer}
    </prop>
    <prop key="hibernate.connection.provider_class">
     ${hibernate.connection.proxool_provider_class}
    </prop>
    <prop key="hibernate.proxool.pool_alias">
     ${hibernate.proxool.pool_alias}
    </prop>
    <prop key="hibernate.proxool.xml">
     ${hibernate.proxool.xml}
    </prop>
    <prop key="hibernate.dialect">
     ${hibernate.dialect}
    </prop>
    <prop key="hibernate.show_sql">
     ${hibernate.show_sql}
    </prop>
    <!-- 缓存设置默认是EhCache -->
    <prop key="hibernate.cache.provider_class">
     org.hibernate.cache.EhCacheProvider
    </prop>
    <!-- enable the query cache -->
    <prop key="hibernate.cache.use_query_cache">true</prop>

    <!-- store the second-level cache entries in a more human-friendly format -->
    <prop key="hibernate.cache.use_structured_entries">
     true
    </prop>
   </props>
  </property>
 
hibernate.cglib.use_reflection_optimizer=true
hibernate.connection.proxool_provider_class=org.hibernate.connection.ProxoolConnectionProvider
hibernate.connection.c3p0_provider_class=org.hibernate.connection.C3P0ConnectionProvider
hibernate.proxool.pool_alias=spring
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.proxool.xml=proxool.xml
hibernate.show_sql=true
 
proxool.xml 配置如下:
<?xml version="1.0" encoding="utf-8"?>
<!-- the proxool configuration can be embedded within your own application's.
 Anything outside the "proxool" tag is ignored. -->
<something-else-entirely>
 <proxool>
  <alias>spring</alias>
  <driver-url>
   jdbc:mysql://localhost:3306/laputaenterprise
  </driver-url>
  <driver-class>org.gjt.mm.mysql.Driver</driver-class>
  <statistics>1m,15m,1d</statistics>
  <driver-properties>
   <property name="user" value="root" />
   <property name="password" value="******" />
  </driver-properties>
  <!-- proxool自动侦察各个连接状态的时间间隔(毫秒),侦察到空闲的连接就马上回收,超时的销毁-->
  <house-keeping-sleep-time>90000</house-keeping-sleep-time>
  <!-- 指因未有空闲连接可以分配而在队列中等候的最大请求数,超过这个请求数的用户连接就不会被接受-->
  <maximum-new-connections>20</maximum-new-connections>
  <!-- 最少保持的空闲连接数-->
  <prototype-count>5</prototype-count>
  <!-- 允许最大连接数,超过了这个连接,再有请求时,就排在队列中等候,最大的等待请求数由maximum-new-connections决定-->
  <maximum-connection-count>100</maximum-connection-count>
  <!-- 最小连接数-->
  <minimum-connection-count>10</minimum-connection-count>
  <trace>true</trace>
  <verbose>true</verbose>
  <house-keeping-test-sql>
   select CURRENT_DATE
  </house-keeping-test-sql>
 </proxool>
</something-else-entirely>
 
OK。
用两天时间终于搞定了proxool的配置,替换了c3p0
rc2版本的proxool折腾死人,不能初始化entity bean。
0.83的在关闭的时候又会报错。什么get cause错误的。
 
总之,RC1没问题了。
sessionFactory的dataSource不用配置了。呵呵
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页