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不用配置了。呵呵
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值