参考了很多网友的文章和文档.现将Spring+Hibernate+Proxool的配置发表如下:

    首先是一个普通的Proxool配置文件
proxool.xml

Spring+Hibernate+Proxool配置<?xml version="1.0" encoding="UTF-8"?>
Spring+Hibernate+Proxool配置
<!-- the proxool configuration can be embedded within your own application's.
Spring+Hibernate+Proxool配置Anything outside the "proxool" tag is ignored. 
-->
Spring+Hibernate+Proxool配置
<something-else-entirely>
Spring+Hibernate+Proxool配置  
<proxool>
Spring+Hibernate+Proxool配置    
<alias>DBPool</alias>
Spring+Hibernate+Proxool配置    
<driver-url>jdbc:mysql://localhost:3306/WebShop</driver-url>
Spring+Hibernate+Proxool配置    
<driver-class>org.gjt.mm.mysql.Driver</driver-class>
Spring+Hibernate+Proxool配置    
<driver-properties>
Spring+Hibernate+Proxool配置      
<property name="user" value="root"/>
Spring+Hibernate+Proxool配置      
<property name="password" value="123456"/>
Spring+Hibernate+Proxool配置    
</driver-properties>
Spring+Hibernate+Proxool配置    
<maximum-connection-count>10</maximum-connection-count>
Spring+Hibernate+Proxool配置    
<house-keeping-test-sql>select CURRENT_DATE</house-keeping-test-sql>
Spring+Hibernate+Proxool配置  
</proxool>
Spring+Hibernate+Proxool配置
</something-else-entirely>
Spring+Hibernate+Proxool配置

    这里面的内容没什么好讲的了,如果不懂的话参考本blog的其它相关文章

    Spring的配置文件
applicationContext.xml
 1Spring+Hibernate+Proxool配置<?xml version="1.0" encoding="UTF-8"?>
 2Spring+Hibernate+Proxool配置<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
 3Spring+Hibernate+Proxool配置<beans>
 4Spring+Hibernate+Proxool配置    <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" singleton="true">
 5Spring+Hibernate+Proxool配置        <property name="hibernateProperties">
 6Spring+Hibernate+Proxool配置            <props>
 7Spring+Hibernate+Proxool配置                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
 8Spring+Hibernate+Proxool配置                <prop key="hibernate.show_sql">true</prop>
 9Spring+Hibernate+Proxool配置                <prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
10Spring+Hibernate+Proxool配置                <prop key="hibernate.proxool.xml">proxool.xml</prop>
11Spring+Hibernate+Proxool配置                <prop key="hibernate.proxool.pool_alias">DBPool</prop>
12Spring+Hibernate+Proxool配置            </props>
13Spring+Hibernate+Proxool配置        </property>
14Spring+Hibernate+Proxool配置        <property name="mappingResources">
15Spring+Hibernate+Proxool配置          <list>
16Spring+Hibernate+Proxool配置              <value>User.hbm.xml</value> 
17Spring+Hibernate+Proxool配置          </list>
18Spring+Hibernate+Proxool配置          </property>
19Spring+Hibernate+Proxool配置    </bean>
20Spring+Hibernate+Proxool配置    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
21Spring+Hibernate+Proxool配置        <property name="sessionFactory">
22Spring+Hibernate+Proxool配置            <ref local="mySessionFactory"/>
23Spring+Hibernate+Proxool配置        </property>
24Spring+Hibernate+Proxool配置    </bean>
25Spring+Hibernate+Proxool配置    <bean id="userDao" class="com.ycoe.blog2.impl.UserDaoImpl">
26Spring+Hibernate+Proxool配置        <property name="sessionFactory">
27Spring+Hibernate+Proxool配置          <ref local="mySessionFactory"/>
28Spring+Hibernate+Proxool配置        </property>
29Spring+Hibernate+Proxool配置    </bean>
30Spring+Hibernate+Proxool配置</beans>
31Spring+Hibernate+Proxool配置

    这里有几个要注意的地方:
    1.这两个文档的放置目录的问题.说得简单些就是要放在classpath路径中.
    2.hibernate.proxool.pool_alias要和proxool.xml中配置的一样!
    3.mappingResources可以将它从这个配置文件中独立来开,以提高配置的结构,易于修改,同理也适用于其它的事务配置
    有些配置细节不再在些处细说,详见本blog的其它文章!
    相关文件下载:https://files.cnblogs.com/ycoe/Spring+Proxool+Hibernate.rar(里面附详细使用说明)

    可以说已经配置完成了,就是这么简单!可以看到Spring的优美,简单,真让人拍案叫绝 

                             --原创文章,可以随意复制,发表,但请注明出处和作者信息,谢谢合作!
                                                                                     By YCOE

相关文章: