以前没有接触过SSH的项目,现在要用,就是赶鸭子上阵,看了别人的一点源码就开始写东西。工程在tomcate5.0上一切都正常,数据源都可以使用,但是放在WAS上先是报警告,不允许直接使用资源。给websphere 6.1.0.0 升级到websphere 6.1.0.19就没警告了。现在的问题是每次访问数据库都是提示资源回滚,数据没法插、更新入到库里。网友都说是把setAutoCommit(true);设为true就可以了。另外写了一个工程,确实也是这样子。不过我的工程是用spring1.2+hibernate3.0写的。因为在spring里可以使用事务代理,我的工程里就没有手动的提交事务这一部代码。不知道有什么办法可以解决没有,现在不可能再给他们加上事务提交。下面给我的spring的配置文件,希望熟悉的兄弟帮忙看一下。
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>jdbc/sysdb</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>
com/sunyard/ispt/model/TableNotice.hbm.xml
</value>
<value>
com/sunyard/ispt/model/TableMaterial.hbm.xml
</value>
<value>
com/sunyard/ispt/model/TableQuestion.hbm.xml
</value>
<value>com/sunyard/ispt/model/TableRule.hbm.xml
</value>
<value>com/sunyard/ispt/model/TablePaper.hbm.xml</value>
<value>
com/sunyard/ispt/model/TableResult.hbm.xml
</value>
<value>
com/sunyard/ispt/model/TableConfig.hbm.xml
</value>
<value>com/sunyard/ispt/model/TablePower.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.query.factory_class">
org.hibernate.hql.classic.ClassicQueryTranslatorFactory
</prop>
</props>
</property>
</bean>
<!-- 配置使用Hibernate局部事务策略 -->
<bean id="transactionManger"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 配置一个事务拦截器 -->
<bean id="transactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<!-- 事务拦截器Bean需要依赖注入一个事务管理器 -->
<property name="transactionManager" ref="transactionManger"></property>
<property name="transactionAttributes">
<!-- 下面定义事务传播属性 -->
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
</beans>
web.xml
<resource-ref>
<description>JNDI JDBC DataSource</description>
<res-ref-name>jdbc/sysdb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
分享到:
相关推荐
WebSphere 6.1 db2 数据源
NULL 博文链接:https://happyjin2010.iteye.com/blog/785173
was相关资料: Websphere安装步骤 websphere安装后配置说明 Websphere实用手册 WebSphere+v6.1配置文档
websphere 6.1安装配置指南websphere 6.1安装配置指南websphere 6.1安装配置指南websphere 6.1安装配置指南websphere 6.1安装配置指南websphere 6.1安装配置指南
MyEclipse 配置 Websphere6.1
WebSphere MySQL 数据源
Websphere6.1 安装 配置 DataSource JDBC JNDI ORACLE
WebSphere6.1 linux windowns 安装部署手册
WebSphere 6.1应用服务器安装部署手册
websphere6.1.0.0升级至6.1.0.17
WebSphere 6.1 SSL配置文档
websphere 6.1中配置DM7数据源
介绍Websphere6.1程序部署,安装,配置,程序包发布等。
WebSpere集群配置\WebSphere6.1安装部署手册.doc
Websphere Application Server 6.1配置JDBC数据源 本文旨在于说明在 webSphere中发布项目和配置数据源。以图文的形式给出明确的配置指导。以配置oracle数据库数据源为实例,所有操作步骤都为实践后的操作步骤。
IBM WebSphere 6.1 ND 集群安装配置
LR8.1监控websphere6.1,讲述在LoadRunner中如何配置WebSphere6.1
WebSphere Application Server Network Deployment 6集群安装部署步骤.docxwebsphere6.1集群配置
Websphere6.1集群安装和配置 Websphere6.1集群安装和配置 Websphere6.1集群安装和配置
1.MyEclipse6.0中Websphere6.1的配置; 2.Websphere6.1基本配置.