ssh框架自动释放资源我项目发布运行以后多点几次分页就卡住了
public void listByPage(String hql, PageResult pageResult){
try{
if (null==hql){
return ;
}
Query query = this.getSession().createQuery(hql);
query.setFirstResult(pageResult.getFirstRec());
query.setMaxResults(pageResult.getPageSize());
List ret = query.list();
pageResult.setList(ret);
String queryString = "";
if (hql.toUpperCase().indexOf("SELECT") != -1) {
int i = query.getQueryString().toUpperCase().indexOf("FROM");
queryString = "Select count(*) " + hql.substring(i,hql.length());
} else {
queryString = "Select count(*) " + hql;
}
// 去掉ORDER BY 的部分
int j = queryString.toUpperCase().lastIndexOf("ORDER");
if (j!=-1){
queryString = queryString.substring(0, j);
}
Query cquery = this.getSession().createQuery(queryString);
cquery.setCacheable(true);
int recTotal = ((Long)cquery.iterate().next()).intValue();
pageResult.setRecTotal(recTotal);
}catch(Exception ex)
{
ex.printStackTrace();
}
这个是我分页的方法 --------------------编程问答-------------------- 听说配置spring事务就可以了 但是还是不行啊
<bean id="MyHibTxManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<tx:advice id="txAdvice" transaction-manager="MyHibTxManager">
<tx:attributes>
<tx:method name="Get*" propagation="SUPPORTS" read-only="true" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="serviceMethods" expression="execution(* dao.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethods" />
</aop:config>
--------------------编程问答-------------------- spring里警告
<bean id="UserDaoImpl" class="dao.UserDaoImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
这一行提示advised by org.springframework.transaction.interceptor.TransactionInterceptor.invoke
(org.aopalliance.intercept.MethodInvocation) --------------------编程问答-------------------- 跪求啊 有哪位高手帮我看看啊
补充:Java , Web 开发