- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
更新: 我正在使用 Bitronix TM 对其进行测试,它可以完美回滚,因此问题出在 JBoss TM (arjuna) 或我的配置中。
更新 2: 看起来事务不是全局的,我尝试了不同的数据源,Bitronix 数据源具有 allowLocalTransactions 属性,在设置它之后我的应用程序抛出异常有些东西试图在本地模式下使用它。如果我将 Bitronix 与此数据源一起使用,它可以正常工作。我相信配置有问题。
我对 JTA 事务有疑问。我正在使用 Tomcat 7 + Hibernate 4 + Spring 3 + JBoss TS 4 和 JTA 事务。
假设有如下方法:
@Transactional(propagation = Propagation.REQUIRED)
public void testMethod() {
insertOfSomeNewEntityInstance();
updateOfAnotherEntity();
}
private void insertOfSomeNewEntityInstance() {
SomeEntity entity = new SomeEntity();
someEntityDAO.save(entity);
}
private void updateOfAnotherEntity() {
AnotherEntity anotherEntity = anotherEntityDAO.findBySomeProperty(1L);
anotherEntity.incrementSomeValue();
anotherEntityDAO.save(anotherEntity);
}
如果此方法在“updateOfAnotherEntity()”方法执行或任何其他过程中抛出“org.hibernate.StaleObjectStateException:行已被另一个事务更新或删除(或未保存的值映射不正确)” “刷新”期间可能发生的运行时异常(Hibernate 还显示:HHH000346:托管刷新期间出错 [行已被另一个事务更新或删除(或未保存的值映射不正确)。则insertOfSomeNewEntityInstance()执行结果不回滚。
在调试这个问题后,我在 org.springframework.transaction.jta.JtaTransaction Manager 中找到了“doCommit”方法
@Override
protected void doCommit(DefaultTransactionStatus status) {
JtaTransactionObject txObject = (JtaTransactionObject) status.getTransaction();
try {
int jtaStatus = txObject.getUserTransaction().getStatus();
if (jtaStatus == Status.STATUS_NO_TRANSACTION) {
throw new UnexpectedRollbackException("JTA transaction already completed - probably rolled back");
}
if (jtaStatus == Status.STATUS_ROLLEDBACK) {
try {
txObject.getUserTransaction().rollback();
}
catch (IllegalStateException ex) {
if (logger.isDebugEnabled()) {
logger.debug("Rollback failure with transaction already marked as rolled back: " + ex);
}
}
throw new UnexpectedRollbackException("JTA transaction already rolled back (probably due to a timeout)");
}
txObject.getUserTransaction().commit();
}
catch (RollbackException ex) {
throw new UnexpectedRollbackException(
"JTA transaction unexpectedly rolled back (maybe due to a timeout)", ex);
}
catch (HeuristicMixedException ex) {
throw new HeuristicCompletionException(HeuristicCompletionException.STATE_MIXED, ex);
}
catch (HeuristicRollbackException ex) {
throw new HeuristicCompletionException(HeuristicCompletionException.STATE_ROLLED_BACK, ex);
}
catch (IllegalStateException ex) {
throw new TransactionSystemException("Unexpected internal transaction state", ex);
}
catch (SystemException ex) {
throw new TransactionSystemException("JTA failure on commit", ex);
}
}
如果“txObject.getUserTransaction().commit();”因 RollbackException 而失败,然后此方法抛出 UnexpectedRollbackException,这是捕获它的 org.springframework.transaction.support.AbstractPl atformTransactionManager processCommit(...) 的一部分:
}
catch (UnexpectedRollbackException ex) {
// can only be caused by doCommit
triggerAfterCompletion(status, TransactionSynchronization.STATUS_ROLLED_BACK);
throw ex;
}
我在 triggerAfterCompletion() 方法中没有看到任何回滚,在这个方法之后,其他一切都只是清理资源。
总结,spring/jboss只是提交了insertOfSomeNewEntityInstance()的结果,updateOfAnotherEntity()执行失败因为并发修改错误,并没有回滚任何东西。如果我从 updateOfAnotherEntity() 手动抛出任何运行时或已检查的异常,它会正确回滚,只有当 Hibernate 在“刷新”期间抛出一些运行时异常时才会出现此问题。
hibernate .cfg
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="dialect">${dialect}</property>
<property name="max_fetch_depth">1</property>
<property name="hibernate.jdbc.batch_size">25</property>
<property name="show_sql">false</property>
<property name="format_sql">false</property>
<property name="use_sql_comments">false</property>
<property name="hibernate.session_factory_name">TestSessionFactory</property>
<property name="hibernate.session_factory_name_is_jndi">false</property>
<property name="hibernate.current_session_context_class">jta</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.jta.platform">org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform</property>
<property name="hibernate.id.new_generator_mappings">true</property>
<property name="hibernate.cache.infinispan.cfg">infinispan.xml</property>
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.infinispan.InfinispanRegionFactory</property>
</session-factory>
</hibernate-configuration>
jbossts-properties.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="CoordinatorEnvironmentBean.commitOnePhase">YES</entry>
<entry key="CoordinatorEnvironmentBean.defaultTimeout">300</entry>
<entry key="ObjectStoreEnvironmentBean.transactionSync">ON</entry>
<entry key="CoreEnvironmentBean.nodeIdentifier">1</entry>
<entry key="JTAEnvironmentBean.xaRecoveryNodes">1</entry>
<entry key="JTAEnvironmentBean.xaResourceOrphanFilterClassNames">
com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter
com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter
</entry>
<entry key="CoreEnvironmentBean.socketProcessIdPort">0</entry>
<entry key="RecoveryEnvironmentBean.recoveryModuleClassNames">
com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule
com.arjuna.ats.internal.txoj.recovery.TORecoveryModule
com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule
</entry>
<entry key="RecoveryEnvironmentBean.expiryScannerClassNames">
com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner
</entry>
<entry key="RecoveryEnvironmentBean.recoveryPort">4712</entry>
<entry key="RecoveryEnvironmentBean.recoveryAddress"></entry>
<entry key="RecoveryEnvironmentBean.transactionStatusManagerPort">0</entry>
<entry key="RecoveryEnvironmentBean.transactionStatusManagerAddress"></entry>
<entry key="RecoveryEnvironmentBean.recoveryListener">YES</entry>
</properties>
applicationContext.xml的一部分
<bean class="com.arjuna.ats.jta.TransactionManager" factory-method="transactionManager" id="arjunaTransactionManager"></bean>
<bean class="com.arjuna.ats.jta.UserTransaction" factory-method="userTransaction" id="arjunaUserTransaction"></bean>
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager" >
<property name="transactionManager" ref="arjunaTransactionManager"/>
<property name="userTransaction" ref="arjunaUserTransaction"/>
</bean>
<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.XADataSource" destroy-method="close">
<property name="url" value="${database.url}" />
<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
<property name="username" value="${database.user}" />
<property name="password" value="${database.password}" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean" destroy-method="destroy">
<property name="dataSource" ref="dataSource"/>
<property name="configLocation"><value>classpath:hibernate.cfg.xml</value></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.cache.use_query_cache">false</prop>
</props>
</property>
</bean>
<tx:annotation-driven mode="proxy" proxy-target-class="false" transaction-manager="transactionManager"/>
和日志:
Completing transaction for [...testMethod]
Triggering beforeCommit synchronization
Triggering beforeCompletion synchronization
BaseTransaction.getStatus
TransactionImple.getStatus
Initiating transaction commit
BaseTransaction.getStatus
TransactionImple.getStatus
BaseTransaction.commit
TransactionImple.commitAndDisassociate
SynchronizationImple.beforeCompletion
BaseTransaction.getStatus
TransactionImple.getStatus
insert into .....
update ... set ...
BaseTransaction.setRollbackOnly
TransactionImple.setRollbackOnly
BasicAction::preventCommit( BasicAction: 0:ffffc0a800ab:8d15:51b6fe47:3 status: ActionStatus.RUNNING)
HHH000346: Error during managed flush [Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [...]]
ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffc0a800ab:8d15:51b6fe47:4, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@76d7a0b8 >
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [...]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:2509) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3228) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3126) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3456) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:140) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:377) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:369) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:287) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:339) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:113) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76) ~[narayana-jta-4.17.4.Final.jar:4.17.4.Final]
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273) ~[narayana-jta-4.17.4.Final.jar:4.17.4.Final]
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93) ~[narayana-jta-4.17.4.Final.jar:4.17.4.Final]
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162) ~[narayana-jta-4.17.4.Final.jar:4.17.4.Final]
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165) ~[narayana-jta-4.17.4.Final.jar:4.17.4.Final]
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126) [narayana-jta-4.17.4.Final.jar:4.17.4.Final]
at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1010) [spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754) [spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) [spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:387) [spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120) [spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) [spring-aop-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at $Proxy126.testMethod(Unknown Source) [na:na]
...
BasicAction::preventCommit( BasicAction: 0:ffffc0a800ab:8d15:51b6fe47:3 status: ActionStatus.ABORT_ONLY)
BasicAction::Abort() for action-id 0:ffffc0a800ab:8d15:51b6fe47:3
SynchronizationImple.afterCompletion
TransactionImple.equals
SynchronizationImple.afterCompletion
BasicAction::removeChildThread () action 0:ffffc0a800ab:8d15:51b6fe47:3 removing TSThread:2
BasicAction::removeChildThread () action 0:ffffc0a800ab:8d15:51b6fe47:3 removing TSThread:2 result = true
TransactionReaper::remove ( BasicAction: 0:ffffc0a800ab:8d15:51b6fe47:3 status: ActionStatus.ABORTED )
Triggering afterCompletion synchronization
Clearing transaction synchronization
Exception
org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1013) ~[spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754) ~[spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) ~[spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:387) ~[spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120) ~[spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) ~[spring-aop-3.1.4.RELEASE.jar:3.1.4.RELEASE]
at $Proxy126.testMethod(Unknown Source) ~[na:na]
...
Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1177) ~[narayana-jta-4.17.4.Final.jar:4.17.4.Final]
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126) ~[narayana-jta-4.17.4.Final.jar:4.17.4.Final]
at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1010) ~[spring-tx-3.1.4.RELEASE.jar:3.1.4.RELEASE]
... 32 common frames omitted
Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [...]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:2509) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3228) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3126) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3456) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:140) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:377) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:369) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:287) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:339) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:113) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76) ~[narayana-jta-4.17.4.Final.jar:4.17.4.Final]
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273) ~[narayana-jta-4.17.4.Final.jar:4.17.4.Final]
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93) ~[narayana-jta-4.17.4.Final.jar:4.17.4.Final]
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162) ~[narayana-jta-4.17.4.Final.jar:4.17.4.Final]
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165) ~[narayana-jta-4.17.4.Final.jar:4.17.4.Final]
... 34 common frames omitted
最佳答案
我发现问题出在配置上。 Tomcat XA 池不知道 JBoss 事务管理器。我尝试像这样将 driverClassName 更改为 TransactionalDriver:
<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.XADataSource" destroy-method="close">
<property name="defaultAutoCommit" value="false" />
<property name="url" value="jdbc:arjuna:" />
<property name="driverClassName">
<value>com.arjuna.ats.jdbc.TransactionalDriver</value>
</property>
<property name="username" value="${database.user}" />
<property name="password" value="${database.password}" />
<property name="initialSize" value="${database.pool.initialSize}"/>
<property name="maxActive" value="${database.pool.maxSize}"/>
<property name="maxIdle" value="${database.pool.maxSize}"/>
<property name="connectionProperties" value="DYNAMIC_CLASS=com.example.CustomDatasourceLoader;"/>
不幸的是,它为子事务抛出了一个异常,说连接属于另一个事务,所以我不得不找到另一个连接池。
Oracle UCP 池也无法正常工作,无法将 driverClassName 更改为 TransactionalDriver,因为它已硬编码为 OracleDriver。
以下配置适用于我(DBCP XA 池)并正确回滚、提交、支持子事务:
<bean id="oracleXADataSource" class="oracle.jdbc.xa.client.OracleXADataSource">
<property name="user" value="${database.user}"/>
<property name="password" value="${database.password}"/>
<property name="URL" value="${database.url}"/>
</bean>
<bean id="dsXAConnectionFactory" class="org.apache.commons.dbcp.managed.DataSourceXAConnectionFactory">
<constructor-arg><ref bean="arjunaTransactionManager"></ref></constructor-arg>
<constructor-arg><ref bean="oracleXADataSource"></ref></constructor-arg>
</bean>
<bean id="pool" class="org.apache.commons.pool.impl.GenericObjectPool">
<property name="maxActive" value="${database.pool.maxSize}"/>
<property name="minIdle" value="${database.pool.initialSize}"/>
</bean>
<bean id="poolableConnectionFactory" class="org.apache.commons.dbcp.PoolableConnectionFactory">
<constructor-arg name="connFactory" ref="dsXAConnectionFactory"/>
<constructor-arg name="pool" ref="pool"/>
<constructor-arg name="stmtPoolFactory"><null></null></constructor-arg>
<constructor-arg name="validationQuery"><null></null></constructor-arg>
<constructor-arg name="defaultReadOnly" value="false"/>
<constructor-arg name="defaultAutoCommit" value="false"/>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.managed.ManagedDataSource" depends-on="poolableConnectionFactory">
<constructor-arg name="pool" ref="pool"/>
<constructor-arg name="transactionRegistry" value="#{dsXAConnectionFactory.getTransactionRegistry()}"/>
</bean>
我对使用 DBCP 池有些担忧,但目前它是唯一可行的解决方案。
关于java - JtaTransactionManager 在 "flush"期间提交失败后没有回滚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17041017/
在MySQL中,执行FLUSH TABLES, PRIVILEGES;和执行FLUSH TABLES;再执行FLUSH PRIVILEGES;效果一样吗?此外,这是否适用于任何刷新选项(FLUSH L
在spring security生成类UserRole或 SecUserSecRole (你可以随便叫它)有一个命令可以创建 new UserRole()并用 .save(flush:flush, i
我正在使用 Hibernate 3.2.6。我正面临异常(exception)情况 save the transient instance before flushing 在我的代码中,有时我们在一个
我有一个 StreamWriter,它的底层流是一个 FileStream。以下代码是否保证 FileStream 也将其缓冲区刷新到文件系统上的实际文件中,还是我需要在 上显式调用 Flush()文
我在 ASP.NET Web API 中使用 PushStreamContent 将事件从服务器推送到客户端(使用服务器发送事件)。每次发送事件后,我都会在 Stream 上调用 Flush 以将缓冲
MSDN说FileStream.Flush(True) “还清除所有中间文件缓冲区。”。 “所有中间文件缓冲区”到底是什么意思? 最佳答案 它会将缓冲在文件系统缓存中的文件数据写入磁盘。该数据通常是根
在我的项目中,我有很多嵌套的对象,几天后服务器在每次查询执行时都变得非常缓慢。 我从object.save(flush:true)中删除了flush:true,这应该避免对象立即被数据库持久化,因为我
假设您需要将二进制数据写入标准输出: sys.stdout.buffer.write(data) 然后要刷新它,您可以使用以下两种方法之一: sys.stdout.flush() sys.stdout
我已经覆盖了 std::ostream::flush() 函数。下面我从示例中删除了所有其他代码: #include #include class CMyStream : public std::
我在我的服务中实现了取消 http 请求,我想测试它: angular.module('EmsWeb.Services').factory('DalService', ['$q', '$http',
有这个 Angular 组件: import { Component, OnDestroy, OnInit } from '@angular/core'; import { asyncSchedule
magento的缓存管理中“Flush Magento Cache”和“Flush Cache Storage”有什么区别? 最佳答案 有时,缓存位置(如 /tmp/)或服务(如 Memcache)会
我有一个实现 postFlush() 的 Hibernate 拦截器.据我了解,刷新后是数据已保存到数据库中,但在调用提交之前可能会回滚。如果我有一个看起来像这样的 hibernate 配置: tru
这是我第一次接触 Clojure,所以我尝试编写一个简单的脚本,它提供基于维基百科的翻译(欢迎任何批评/评论) 问题是:当我从翻译中删除(刷新)时,脚本输出 nil 而不是翻译后的单词。这是为什么?我
我正在开发 iPhone 应用程序并希望使用: CFStreamCreatePairWithSocketToHost(NULL, url, port, &serverReadStream, &serv
我有一个相机将图片发送到回调函数,我想使用 FFmpeg 用这些图片制作一部电影。我遵循了 decoding_encoding 示例 here但我不确定如何使用 got_output 刷新编码器并获取
is_master_def: volatile bool is_master_; is_master_ 值被另一个线程设置为 true,但似乎 is_master_ 值 dosnt 刷新(它没有计算出
什么意思 “我会在您将所有内容发送给客户端并刷新后执行此操作。” 谢谢你 最佳答案 刷新是对数据流进行缓冲时涉及的操作。 让我们假设一个普通的stdout 流。每个字节一到达就打印出来效率很低,这就是
我们正在开发 iMX6Sx Freescale 开发板,使用 Yocto 构建 Linux 内核发行版。我想知道是否有办法检查是否有可能检查文件系统操作(特别是写入)是否真的终止,避免在操作仍在进行时
我已经实现了一个 Java 程序,它通过 ServerSocket 从 GPS 设备读取数据。 ServerSocket serverSocket = new ServerSocket(13811);
我是一名优秀的程序员,十分优秀!