繁体   English   中英

在关闭事务时,Oracle DB Link不会更新数据库

[英]On closing transaction, Oracle DB Link doesn't update the database

我在数据库“ A”下有一些插入操作。 接下来,我对数据库“ A”进行了操作,该操作使用Oracle DB Link与数据库“ B”连接以更新到第二个数据库。 方法执行完成后,对数据库“ A”的所有操作都将保留,但对数据库“ B”的操作不存在。

我正在使用Spring 3.2.3.RELEASE和MyBatis 3.2.3

我的applicationContext.xml:

<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="get*" read-only="true" />
        <tx:method name="*" />
    </tx:attributes>
</tx:advice>

<aop:config proxy-target-class="false">
    <aop:pointcut id="businessEbOperation" expression="bean(*BO)" />
    <aop:advisor advice-ref="txAdvice" pointcut-ref="businessEbOperation" />
</aop:config>

<!-- define the SqlSessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="typeAliasesPackage" value="com.foo.core.entities" />
    <property name="configLocation" value="classpath:mybatis-config.xml" />
</bean>

<!-- Oracle 10g DataSource -->
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName">
        <value>java:/OracleDS</value>
    </property>
</bean>

提前致谢!

最初,我认为问题出在数据库配置,但是当我在MyBatis中修改查询时,我检测到标记select而不是标记update

<update id="cancelPackage" statementType="CALLABLE">
    {call pa_packages.cancel_cellular_packages(
    #{PKT_ID, mode=IN, jdbcType=VARCHAR}
    , #{CAN_DATE, mode=IN, jdbcType=DATE, javaType=java.util.Date}
    , #{CELLULAR, mode=IN, jdbcType=VARCHAR}
    ...)}
</update>

结论是,数据库链接的使用是透明的,并且由数据库处理。 函数结束时,所有修改都将提交。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM