Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Architecture & Framework » Spring Framework  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:spring+hibernate如何配置支持连接池重连接 [Re:lianghyan]
lianghyan





发贴: 38
积分: 1
于 2004-11-04 12:41 user profilesend a private message to usersend email to lianghyansearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在spring的applicationContext.xml中配置如下
<!-- Hibernate SessionFactory -->
  <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
    <property name="configLocation"> <value>classpath:hibernate.cfg.xml</value></property>
  </bean>

  <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
  <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
    <property name="sessionFactory"><ref local="sessionFactory"/></property>
  </bean>

在hibernate.cfg.xml的配置如下:

<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://192.168.12.99:3306/test?useUnicode=true&characterEncoding=gb2312</property>

<property name="connection.username">hello</property>
<property name="connection.password"></property>
<property name="connection.pool_size">5</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.show_sql">true</property>

<property name="transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>




关于Jute Forum的长期发展给官方的建议

话题树型展开
人气 标题 作者 字数 发贴时间
12185 spring+hibernate如何配置支持连接池重连接 lianghyan 6060 2004-11-04 09:53
9995 Re:spring+hibernate如何配置支持连接池重连接 net0309 26 2004-11-04 11:55
10525 Re:spring+hibernate如何配置支持连接池重连接 lianghyan 1231 2004-11-04 12:41
9329 Re:spring+hibernate如何配置支持连接池重连接 enhydra 38 2004-11-04 16:45
9669 Re:spring+hibernate如何配置支持连接池重连接 lianghyan 63 2004-11-04 17:42
10269 Re:spring+hibernate如何配置支持连接池重连接 lianghyan 35 2004-11-05 13:03

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923