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不用配置了。呵呵
阅读更多

Spring+Hibernate+Proxool配置问题_急

05-23

我用Spring+Hibernate+Proxool配置,Tomcat启动的时候报了一个警告:rnWARN [org.hibernate.connection.UserSuppliedConnectionProvider] - No connection properties specified - the user must supply JDBC connectionsrn访问工程的时候就报了:rnorg.springframework.web.struts.DelegatingActionProxyrnjava.lang.UnsupportedOperationException: The user must supply a JDBC connectionrn at java.lang.Thread.run(Unknown Source)rn我的proxool.xml配置文件:rnrnrnrn rn DBConnectionrn rn jdbc:mysql://192.168.0.193/shopping?useUnicode=true&characterEncoding=UTF-8&user=shopping&password=shoppingrn rn org.gjt.mm.mysql.Driverrn 1m,15m,1drn rn rn rn rn rn 90000rn rn 20rn rn 5rn rn 100rn rn 10rn truern truern rn select CURRENT_DATErn rn rnrnrnapplicationContext.xml文件:rnrn rnrnrnrnrn rn rn rn rn rn rn com/zul/entity/Users.hbm.xmlrn com/zul/entity/Address.hbm.xmlrn com/zul/entity/Integral.hbm.xmlrn com/zul/entity/Letter.hbm.xmlrn com/zul/entity/Order.hbm.xmlrn com/zul/entity/OrderStatus.hbm.xmlrn com/zul/entity/ProductImages.hbm.xmlrn com/zul/entity/ProductInfo.hbm.xmlrn com/zul/entity/ProductType.hbm.xmlrn com/zul/entity/SendLetter.hbm.xmlrn com/zul/entity/ShoppingCar.hbm.xmlrn com/zul/entity/TalkAboutProduct.hbm.xmlrn com/zul/entity/UserCollection.hbm.xmlrn com/zul/entity/UserIp.hbm.xmlrn com/zul/entity/FriendlyLink.hbm.xmlrn com/zul/entity/AdminInfo.hbm.xmlrn com/zul/entity/OrderDetailInfo.hbm.xmlrn com/zul/entity/Advertisement.hbm.xmlrn com/zul/entity/Cooperate.hbm.xmlrn com/zul/entity/Fontcount.hbm.xmlrn com/zul/entity/LoginIp.hbm.xmlrn com/zul/entity/Logrecord.hbm.xmlrn com/zul/entity/Placard.hbm.xmlrn com/zul/entity/Popedom.hbm.xmlrn com/zul/entity/Role.hbm.xmlrn com/zul/entity/Slideintercalate.hbm.xmlrn com/zul/entity/TextAdvertisement.hbm.xmlrn rn rn rn rn rn rn $hibernate.cglib.use_reflection_optimizerrn rn rn $hibernate.connection.proxool_provider_classrn rn rn DBConnectionrn rn rn $proxool.xmlrn rn rn org.hibernate.dialect.MySQLDialectrn rn rn truern rn rn rn org.hibernate.cache.EhCacheProviderrn rn rn truernrn rn rn truern rn truern rn rn rn rn rn rn rn rnrn rnrn rnrn rn rn rn rn rn rn rn rn rn rn rnrnrn请问应该怎么解决啊?

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