帖子内容有点长、大侠们耐心点看:
系统用的SSH框架、有时候前台点击跟数据库交互就会报超出最大游标数的错误。
我不知道什么问题、下面把配置跟部分代码贴出来、大侠指正。
数据源:
- XML code
<Resource name="jdbc/customermanage" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="......" password="......" driverClassName="oracle.jdbc.OracleDriver" url=".................."/>
Spring配置:
- XML code
<aop:config> <aop:pointcut id="logger" expression="execution(* com.chinaboxun.*.*.service.*(..))" /> <aop:aspect id="loggerAspect" ref="genericLogger"> <aop:around pointcut-ref="logger" method="invoke" /> </aop:aspect> </aop:config><bean id="TransactionProxyFactory" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true"> <property name="transactionManager" ref="TransactionManager"/> <property name="transactionAttributes"> <props> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> <prop key="run">PROPAGATION_REQUIRED</prop> <prop key="send*">PROPAGATION_REQUIRED</prop> <prop key="doInit*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="query*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="is*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="edit*">PROPAGATION_REQUIRED</prop> </props> </property> </bean>
事务处理呢、是木有问题的。
在Action调用Service的方法(不处理异常信息):
- Java code
Object[] objs =customerManage.selectBymanage(......);//......
Service呢调用dao层方法(try了一下异常信息、但是dao层方法并不将异常抛出来):
- Java code
numbers = hqlDao.find(sqlCount.toString(), params);//......
dao层方法:
- Java code
//类继承了HibernateDaoSupportprivate Session session = null;public List<T> find(String hql, List<T> params, int pageRows, int pageIndex){ // TODO Auto-generated method stub List result = null; if (null != hql && !"".equals(hql.trim())){ try { session = this.getSession(); Query query = session.createQuery(hql); if (null != params) { for(int i = 0; i < params.size(); i++) { query.setParameter(i, params.get(i)); } } if (pageRows > 0 && pageIndex > 0) { query.setMaxResults(pageRows); query.setFirstResult(pageRows * (pageIndex - 1)); } result = query.list(); } catch (Exception ex) { ex.printStackTrace(); } } return result; }