我的Spring配置文件如下。感觉配置没有问题了,程序运行也没有报错,保存后的数据能够再次查询到,但是没有存到数据库中。请问是怎么回事?急急。。<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <!--获取hibernate工厂-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocations" value="classpath:hibernate.cfg.xml"/>
</bean> <!-- 事务管理 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean> <!-- 自动代理 -->
<bean id="autoproxy" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<!-- 可以是Service或DAO层(最好是针对业务层*Service) -->
<property name="beanNames">
<list>
<value>/*</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
</list>
</property>
</bean>
<bean id="newsDAO" class="dao.news.NewsDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="stringUtil" class="util.StringUtil"></bean>
<bean name="/addnews" class="struts.action.AddnewsAction">
<property name="newsDAO">
<ref local="newsDAO"/>
</property>
</bean></beans>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <!--获取hibernate工厂-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocations" value="classpath:hibernate.cfg.xml"/>
</bean> <!-- 事务管理 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean> <!-- 自动代理 -->
<bean id="autoproxy" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<!-- 可以是Service或DAO层(最好是针对业务层*Service) -->
<property name="beanNames">
<list>
<value>/*</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
</list>
</property>
</bean>
<bean id="newsDAO" class="dao.news.NewsDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="stringUtil" class="util.StringUtil"></bean>
<bean name="/addnews" class="struts.action.AddnewsAction">
<property name="newsDAO">
<ref local="newsDAO"/>
</property>
</bean></beans>
解决方案 »
- 如何用JavaScript实现返回到上一页?
- 有关oracle连接怎么不重复连接。详细请进。
- webservice客户端出错java.lang.IllegalStateException:Service class is not an interface
- java j2EE java web 技术交流群(110933044(java技术交流))
- java经典的MD5加密工具类谁有?
- 求大侠给个答案
- 哪位老师能举一个加<html:base>和不加的区别,感谢
- 在开发的时候已经定义了一个<forrow为 xx.do 但是我现在又想给他加个参数 xx.do?id=1
- 我快疯掉了!!!!!!!!!!!!
- 求解决
- tomcat 500 错误 大家看看这是什么错误,我新手,编译老是出现异常
- struts2 tiles 和ssl 同时使用
<!-- 可以是Service或DAO层(最好是针对业务层*Service) -->
<property name="beanNames">
<list>
<value>/*</value> // 换成具体的service试试
</list>