首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Hibernate设立使用C3P0连接池

2012-09-09 
Hibernate设置使用C3P0连接池1.导入jar文件2.修改hibernate.cfg.xml?xml version1.0 encodingutf-8

Hibernate设置使用C3P0连接池

1.导入jar文件
2.修改hibernate.cfg.xml

<?xml version='1.0' encoding='utf-8'?><!DOCTYPE hibernate-configuration PUBLIC        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration>    <session-factory><property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property><property name="hibernate.c3p0.min_size">5</property><property name="hibernate.c3p0.man_size">10</property><property name="hibernate.c3p0.man_statements">50</property><property name="hibernate.c3p0.timeout">3600</property><property name="hibernate.c3p0.idle_test_period">120</property><property name="hibernate.c3p0.acquire_increment">2</property>        <!-- SQL dialect -->        <property name="dialect">org.hibernate.dialect.HSQLDialect</property>        <!-- Enable Hibernate's current session context -->        <property name="current_session_context_class">org.hibernate.context.ManagedSessionContext</property>        <!-- Disable the second-level cache  -->        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>        <!-- Echo all executed SQL to stdout -->        <property name="show_sql">true</property>        <!-- Drop and re-create the database schema on startup -->        <property name="hbm2ddl.auto">create</property>        <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/>    </session-factory></hibernate-configuration>

?将这些配置加入到hibernate.cfg.xml配置文件中即可

?

热点排行