Hibernate中怎么样设置池连发呆数? 请给出Hibernate.cfg.xml里的代码。那个属性是设置发呆数说明一下。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?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="hibernate.cglib.use_reflection_optimizer">true</property> <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <property name="hibernate.connection.password">genka_user</property> <property name="hibernate.connection.url">jdbc:oracle:thin:@192.168.1.251:1521:genka</property> <property name="hibernate.connection.username">genka_user</property> <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property> <property name="hibernate.show_sql">true</property> <mapping resource="jp/co/genka/entity/GtTukbetTeamDtl.hbm.xml" /> <mapping resource="jp/co/genka/entity/GmBumon.hbm.xml" /> <mapping resource="jp/co/genka/entity/GmTorhsakKanr.hbm.xml" /> <mapping resource="jp/co/genka/entity/GtTukbetKyuy.hbm.xml" /> <mapping resource="jp/co/genka/entity/GtKadoKosu.hbm.xml" /> <mapping resource="jp/co/genka/entity/GtPrjKanr.hbm.xml" /> <mapping resource="jp/co/genka/entity/GtJinkhDtl.hbm.xml" /> <mapping resource="jp/co/genka/entity/GmCode.hbm.xml" /> <mapping resource="jp/co/genka/entity/GmKyuy.hbm.xml" /> <mapping resource="jp/co/genka/entity/GmGamenRank.hbm.xml" /> <mapping resource="jp/co/genka/entity/GtBumonSyokui.hbm.xml" /> <mapping resource="jp/co/genka/entity/GtMsg.hbm.xml" /> <mapping resource="jp/co/genka/entity/GmSecrtKanr.hbm.xml" /> <mapping resource="jp/co/genka/entity/GtIdoRirek.hbm.xml" /> <mapping resource="jp/co/genka/entity/GmSyan.hbm.xml" /> <mapping resource="jp/co/genka/entity/GmSyokui.hbm.xml" /> <mapping resource="jp/co/genka/entity/GtSyanRank.hbm.xml" /> <mapping resource="jp/co/genka/entity/GmRank.hbm.xml" /> <mapping resource="jp/co/genka/entity/GmKyoryokSyain.hbm.xml" /> <mapping resource="jp/co/genka/entity/GtTeamKanrDtl.hbm.xml" /> <mapping resource="jp/co/genka/entity/GtPrjMony.hbm.xml" /> <mapping resource="jp/co/genka/entity/GmSecrtSrcn.hbm.xml" /> <mapping resource="jp/co/genka/entity/GtKanjoKamk.hbm.xml" /> <mapping resource="jp/co/genka/entity/GmYusen.hbm.xml" /> </session-factory></hibernate-configuration> <property name="hibernate.cglib.use_reflection_optimizer"> true </property> <property name="hibernate.connection.driver_class"> oracle.jdbc.driver.OracleDriver </property> <property name="hibernate.connection.password"> genka_user </property> <property name="hibernate.connection.url"> jdbc:oracle:thin:@192.168.1.251:1521:genka </property> <property name="hibernate.connection.username"> genka_user </property> <property name="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </property> <property name="hibernate.show_sql"> true </property> 这个为数据库配置 <mapping resource=" 。这个为数据库的数据表对应生成的配置文件 Hibernate支持4种类型的连接池(所需要的jar包在下载的hibernate.zip压缩包中都有),具体如下:1>hibernate自带的: #hibernate.connection.pool_size 连接池容量上限数目(只有这一项配置)2>c3p0 #hibernate.c3p0.max_size 2 最大连接数 #hibernate.c3p0.min_size 2 #hibernate.c3p0.timeout 5000 数据库连接对象最大持有时间(以秒为单位) #hibernate.c3p0.max_statements 100 最大可缓存数据库语句对象,设为0则不缓存 #hibernate.c3p0.idle_test_period 3000 #hibernate.c3p0.acquire_increment 2 #hibernate.c3p0.validate false3>proxool #hibernate.proxool.pool_alias pool1##===Only need one of the following=== #hibernate.proxool.existing_pool true #hibernate.proxool.xml proxool.xml #hibernate.proxool.properties proxool.properties4>DBCP #hibernate.dbcp.maxActive 最大有效的数据库连接数 #hibernate.dbcp.maxIdle 最大空闲的数据库连接数 #hibernate.dbcp.maxWait 数据库连接最大可空闲时间(以毫秒为单位,设为-1则关闭) #hibernate.dbcp.whenExhaustedAction 当连接池的连接耗尽时的对策,为0则不予响应,为1则阻塞直到有可用的连接,为2则新增加一个连接 #hibernate.dbcp.testOnBorrow 当从连接池获得连接时是否检验该连接有效 #hibernate.dbcp.testOnReturn 当连接返回连接池中时,是否检验该连接有效或者http://cache.baidu.com/c?word=hibernate%2C%C1%AC%BD%D3%3B%B3%D8&url=http%3A//blog%2Ecsdn%2Enet/kang275284/archive/2007/11/30/1909249%2Easpx&p=882a9340a48716f913b1c7710c1486&user=baidu java中函数调用与C++的一个区别?谢谢您 关于static方法 鼠标放上去让图片放大??? 小女子跪求!!! 异常 java.lang.NullPointerException ?? 如何利用设置classpath引用同一个包中的另一个实用类? 请 Swing 高手指教:java 如何实现点击窗口最小化时在最右下角的任务栏有图标显示。 紧急求救,大家帮我看看!在县等待! 何为虚拟机的关闭?? 关于用java实现广播、组播的疑惑 java的模板中为什么不能接受内置数据类型(e.g. int),而必须接受Integer? 郁闷!JDeveloper10.1.3。散分
<!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="hibernate.cglib.use_reflection_optimizer">true</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.password">genka_user</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@192.168.1.251:1521:genka</property>
<property name="hibernate.connection.username">genka_user</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.show_sql">true</property>
<mapping resource="jp/co/genka/entity/GtTukbetTeamDtl.hbm.xml" />
<mapping resource="jp/co/genka/entity/GmBumon.hbm.xml" />
<mapping resource="jp/co/genka/entity/GmTorhsakKanr.hbm.xml" />
<mapping resource="jp/co/genka/entity/GtTukbetKyuy.hbm.xml" />
<mapping resource="jp/co/genka/entity/GtKadoKosu.hbm.xml" />
<mapping resource="jp/co/genka/entity/GtPrjKanr.hbm.xml" />
<mapping resource="jp/co/genka/entity/GtJinkhDtl.hbm.xml" />
<mapping resource="jp/co/genka/entity/GmCode.hbm.xml" />
<mapping resource="jp/co/genka/entity/GmKyuy.hbm.xml" />
<mapping resource="jp/co/genka/entity/GmGamenRank.hbm.xml" />
<mapping resource="jp/co/genka/entity/GtBumonSyokui.hbm.xml" />
<mapping resource="jp/co/genka/entity/GtMsg.hbm.xml" />
<mapping resource="jp/co/genka/entity/GmSecrtKanr.hbm.xml" />
<mapping resource="jp/co/genka/entity/GtIdoRirek.hbm.xml" />
<mapping resource="jp/co/genka/entity/GmSyan.hbm.xml" />
<mapping resource="jp/co/genka/entity/GmSyokui.hbm.xml" />
<mapping resource="jp/co/genka/entity/GtSyanRank.hbm.xml" />
<mapping resource="jp/co/genka/entity/GmRank.hbm.xml" />
<mapping resource="jp/co/genka/entity/GmKyoryokSyain.hbm.xml" />
<mapping resource="jp/co/genka/entity/GtTeamKanrDtl.hbm.xml" />
<mapping resource="jp/co/genka/entity/GtPrjMony.hbm.xml" />
<mapping resource="jp/co/genka/entity/GmSecrtSrcn.hbm.xml" />
<mapping resource="jp/co/genka/entity/GtKanjoKamk.hbm.xml" />
<mapping resource="jp/co/genka/entity/GmYusen.hbm.xml" />
</session-factory>
</hibernate-configuration>
<property name="hibernate.connection.driver_class"> oracle.jdbc.driver.OracleDriver </property>
<property name="hibernate.connection.password"> genka_user </property>
<property name="hibernate.connection.url"> jdbc:oracle:thin:@192.168.1.251:1521:genka </property>
<property name="hibernate.connection.username"> genka_user </property>
<property name="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </property>
<property name="hibernate.show_sql"> true </property>
这个为数据库配置 <mapping resource=" 。
这个为数据库的数据表对应生成的配置文件
1>hibernate自带的:
#hibernate.connection.pool_size 连接池容量上限数目(只有这一项配置)
2>c3p0
#hibernate.c3p0.max_size 2 最大连接数
#hibernate.c3p0.min_size 2
#hibernate.c3p0.timeout 5000 数据库连接对象最大持有时间(以秒为单位)
#hibernate.c3p0.max_statements 100 最大可缓存数据库语句对象,设为0则不缓存
#hibernate.c3p0.idle_test_period 3000
#hibernate.c3p0.acquire_increment 2
#hibernate.c3p0.validate false
3>proxool
#hibernate.proxool.pool_alias pool1
##===Only need one of the following===
#hibernate.proxool.existing_pool true
#hibernate.proxool.xml proxool.xml
#hibernate.proxool.properties proxool.properties
4>DBCP
#hibernate.dbcp.maxActive 最大有效的数据库连接数
#hibernate.dbcp.maxIdle 最大空闲的数据库连接数
#hibernate.dbcp.maxWait 数据库连接最大可空闲时间(以毫秒为单位,设为-1则关闭)
#hibernate.dbcp.whenExhaustedAction 当连接池的连接耗尽时的对策,为0则不予响应,为1则阻塞直到有可用的连接,为2则新增加一个连接
#hibernate.dbcp.testOnBorrow 当从连接池获得连接时是否检验该连接有效
#hibernate.dbcp.testOnReturn 当连接返回连接池中时,是否检验该连接有效
或者
http://cache.baidu.com/c?word=hibernate%2C%C1%AC%BD%D3%3B%B3%D8&url=http%3A//blog%2Ecsdn%2Enet/kang275284/archive/2007/11/30/1909249%2Easpx&p=882a9340a48716f913b1c7710c1486&user=baidu