关于SSH事务问题,求帮解决............非常奇怪项目不报错,而且数据没有提交到数据库, 更奇怪的有时候会提交,一两个字段....

2014-01-02 17:24:38 +08:00
 125204412
spring的xml代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
">
<!-- <import resource="" /> -->
<context:property-placeholder location="classpath:source/jdbc.properties" />
<!-- 通过JNDI配置DataSource <bean id="datasource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"> <value>java:comp/env/jdbc/jboa</value> </property>
</bean> -->
<!-- <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="username" value="${jdbc.username}" /> <property name="password"
value="${jdbc.password}"/> <property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/> </bean> -->
<!-- C3P0 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="user" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="driverClass" value="${jdbc.driverClassName}" />
<property name="jdbcUrl" value="${jdbc.url}" />
<!--连接池最大连接数 -->
<property name="maxPoolSize" value="40"></property>
<!--连接池最小连接数 -->
<property name="minPoolSize" value="1"></property>
<!--初始化参数 -->
<property name="initialPoolSize" value="1"></property>
<!--连接的最大空闲时间,超时的连接将被丢弃,单位:秒 -->
<property name="maxIdleTime" value="60"></property>
<!--没有连接可用时,等待连接的时间,单位毫秒 -->
<property name="checkoutTimeout" value="2000"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<!-- <property name="configLocation" value="classpath:hibernate.cfg.xml">
</property> -->
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
</props>
</property>
<!-- hbm文件已改成通过插件加载 -->
<property name="mappingResources">
<list>
<value>com/bdqn/wls/entity/xml/Book.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/OrderOperate.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/BookType.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Department.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Menu.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Mistake.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Order.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Person.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Position.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Power.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Role.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Send.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Site.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Stock.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/StockRecord.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/StoreRoom.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Supplier.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Supply.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/Transport.hbm.xml</value>
<value>com/bdqn/wls/entity/xml/User.hbm.xml</value>
</list>
</property>
</bean>
<import resource="applicationContext-*" />
<!-- 声明式事务 -->
<!-- 事务管理器 -->
<bean class="org.springframework.orm.hibernate3.HibernateTransactionManager"
id="transactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 事务管理通知 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="*" propagation="SUPPORTS" read-only="true" />
</tx:attributes>
</tx:advice>
<!-- aop -->
<aop:config>
<aop:pointcut expression="execution(* com.bdqn.wls.service.impl.*.*(..))"
id="bizMethod" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethod" />
</aop:config>
</beans>
3107 次点击
所在节点    问与答
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/95394

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX