今天没事把原来项目里的spring换成了spring2.5,这下可好,项目出大漏子了
花点时间解决了,老鸟就不要看了,主要给新手提个醒~~~
第一个就是引入命名空间的那段配置不同了
注意红色部分,少了就是不行~~~~~~~~~,这个郁闷了好久
第二个就是注意配置TransactionManager这个bean,如果是jdbc方式的话
就ok了,不过你整合和hibernate的话,可要小心了,如果你还是按照上面这个配置的话呢
像readOnly这样的属性会依然起效,但是,这也是最麻痹人的地方,[color=red]这样直接就导致了异常
不回滚!!![/color]
所以,有了hibernate之后应该使用
这样的话,一切又和谐了~~~
花点时间解决了,老鸟就不要看了,主要给新手提个醒~~~
第一个就是引入命名空间的那段配置不同了
<beans
xmlns="http://www.springframework.org/schema/beans"
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.5.xsd
[color=red]http://www.springframework.org/schema/aop[/color]
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
[color=red]http://www.springframework.org/schema/tx[/color]
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
注意红色部分,少了就是不行~~~~~~~~~,这个郁闷了好久
第二个就是注意配置TransactionManager这个bean,如果是jdbc方式的话
<bean id="txManage2" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
就ok了,不过你整合和hibernate的话,可要小心了,如果你还是按照上面这个配置的话呢
像readOnly这样的属性会依然起效,但是,这也是最麻痹人的地方,[color=red]这样直接就导致了异常
不回滚!!![/color]
所以,有了hibernate之后应该使用
<bean id="txManage" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
这样的话,一切又和谐了~~~
352

被折叠的 条评论
为什么被折叠?



