我用的是ssh框架,在action中调用hibernate 的findbyId()方法。。调出记录。。修改了一个字段,然后saveOrUpdate,然后又findall调出所以记录列表显示。这就样的操作,连续操作大概有五六次吧应用就无法响应了。。为什么呢。。我该怎么优化一下呢? 是不是在spring中配置些什么呢? 高手请指教!
解决方案 »
- 类似在线编辑图像功能
- 你们说使用SSH到底是为了快速开发,还是为了标准?
- struts1改struts2
- 谁有itcastforum的源代码,给我一份谢谢。
- 挺简单的一个链接:找不到符号.,My god!
- Apache与Tomcat的三种连接方式介绍
- 怎么把字符串“yyyy-MM-dd HH:mm:ss”转成“yyyy-MM-dd”(在线)
- *******请高手指教******看看运行hihernate运行时候出现的错误是什么?怎么解决?
- JB8+Weblogic7的问题:在JB中启动Weblogic有错误
- 大家帮忙看看Deploy最后一步报的这个错是怎么回事?
- EJB中的LOCAL与REMOTE什么区别
- field的getLong()方法
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="SessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
自己看看我也不知道是哪
1\你的数据库访问类如果继承或者扩展HibernateDaoSupport,可利用spring容器的机制去释放
2\建议你将这些操作放到一个事务下,可以使用容器事务配置的方式来定义,不用改程序.
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="find*" read-only="true" />
<tx:method name="get*" read-only="true" />
<tx:method name="check*" read-only="true" />
<tx:method name="query*" read-only="true" />
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<aop:config proxy-target-class="true">
<aop:pointcut id="service"
expression="execution(* test1.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="service" />
</aop:config>
具体的记不得了,