在我的应用中采用weblogic作为应用服务器,但是就数据连接池使用weblogic的还是hibernate的产生了一些问题(驱动都是JTDS):
由Hibernate自己管理连接池时我是这样设置的:
<property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:jtds:sqlserver://192.168.0.1/db;useUnicode=true;characterEncoding=gb2312</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password">sa</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.connection.isolation">1</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.max_fetch_depth">1</property>
<property name="hibernate.use_outer_join">false</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="jdbc.fetch_size">100</property>
<property name="jdbc.batch_size">50</property>
<property name="jdbc.use_scrollable_resultset">false</property>
<property name="hibernate.c3p0.max_size">100</property>
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.idle_test_period">100</property>
<property name="hibernate.c3p0.acquire_increment">2</property>
<property name="hibernate.c3p0.validate">false</property>
此时感觉性能差些,但未出现事务锁死锁。
采用weblogic的连接池,Hibernate通过JNDI访问时,设置如下:
<property name="hibernate.connection.datasource">my_jtds_pool</property>
<property name="hibernate.session_factory_name">net.sf.hibernate.SessionFactory</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.connection.isolation">1</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.max_fetch_depth">1</property>
<property name="hibernate.use_outer_join">false</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="jdbc.fetch_size">100</property>
<property name="jdbc.batch_size">50</property>
<property name="jdbc.use_scrollable_resultset">false</property>
<property name="hibernate.c3p0.max_size">100</property>
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.idle_test_period">100</property>
<property name="hibernate.c3p0.acquire_increment">2</property>
<property name="hibernate.c3p0.validate">false</property>
这是感觉系统性能较高,但是频繁出现事务死锁,我不知道在第二种设置中少了什么,在weblogic的控制台中创建数据连接池时,我只是将连接数增达到100,其他未作变化都是默认的。
我应该设置些什么参数呢?或者我有哪些参数设置错了? 请多指教。
另,我的应用同时在线有300人左右,HttpSession数量300~400,事务较大,属于ERP类的应用。