关于SSH的问题

来源:互联网  时间:2016/6/29 11:38:18

关于网友提出的“ 关于SSH的问题”问题疑问,本网通过在网上对“ 关于SSH的问题”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题: 关于SSH的问题
描述:

我用ssh做的一个小系统,做了几次查询动作,原先速度很快,可是后数据就出不来了?也不报错。要重启tomcat服务器才能继续查询数据库,请问这问题怎么解决? 这是我的配置文件代码:



	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
	
		

<> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

/> org.hibernate.dialect.MySQLDialect true <> true

update 30 5
/> 1800 50
  

3000
2
/> true

  true 
/> org.hibernate.cache.EhCacheProvider 



com/weibo/model/User.hbm.xml com/weibo/model/Group.hbm.xml
/> com/weibo/model/Weibo.hbm.xml com/weibo/model/Topic.hbm.xml
com/weibo/model/Transmit.hbm.xml com/weibo/model/Label.hbm.xml
com/weibo/model/Activity_Category.hbm.xml
com/weibo/model/Group_Category.hbm.xml com/weibo/model/Activity.hbm.xml com/weibo/model/Message.hbm.xml com/weibo/model/Activity_Message.hbm.xml com/weibo/model/User_Group.hbm.xml
com/weibo/model/User_Activity.hbm.xml com/weibo/model/Activity_Comment.hbm.xml com/weibo/model/Admin.hbm.xml com/weibo/model/Propaganda.hbm.xml
com/weibo/model/Love_Weibo.hbm.xml com/weibo/model/Weibo_Comment.hbm.xml com/weibo/model/Listen.hbm.xml
com/weibo/model/Comment_Message.hbm.xml com/weibo/model/User_Label.hbm.xml com/weibo/model/Weibo_Label.hbm.xml



解决方案1:

没有close();

解决方案2:

你这里面用了两种写法,第一种就属于自己获取了数据库连接: Session sess=(Session) this.getSession(); List list = sess.createQuery("from Activity a order by a.activity_up desc,a.activity_up_time desc,a.publish_time desc")                 .setFirstResult(firstResult)                 .setMaxResults(maxResults).list(); 因此必须在finally中进行关闭: Session sess=(Session) this.getSession(); //这句话就是自己取出了连接,一般只有在需要自行维护事务的时候才会这样做。 try {   List list = sess.createQuery("from Activity a order by a.activity_up desc,a.activity_up_time desc,a.publish_time desc")                 .setFirstResult(firstResult)                 .setMaxResults(maxResults).list(); } finally {   sess.close(); }

解决方案3:

检查下代码,是否有自己获取数据库连接的危险行为?从你描述现象来看,很像是数据库连接耗尽,也就是没有释放数据库连接所致。

上一篇sql调用数据库在jsp页面显示问题
下一篇orgapachejasperJasperException: /pages/teacherlistjsp130,0 Unterminated &l
明星图片
相关文章
《 关于SSH的问题》由码蚁之家搜集整理于网络,
联系邮箱:mxgf168#qq.com(#改为@)