mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
fix: NPE in FlexTransactionManager.java
This commit is contained in:
parent
f0e54c0fc1
commit
35e2991ed8
@ -39,12 +39,7 @@
|
|||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-jdbc</artifactId>
|
<artifactId>spring-jdbc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.mybatis-flex</groupId>
|
|
||||||
<artifactId>mybatis-flex-annotation</artifactId>
|
|
||||||
<version>1.7.4</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import org.springframework.transaction.support.DefaultTransactionStatus;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* MyBatis-Flex 事务支持。
|
* MyBatis-Flex 事务支持。
|
||||||
|
*
|
||||||
* @author michael
|
* @author michael
|
||||||
*/
|
*/
|
||||||
public class FlexTransactionManager extends AbstractPlatformTransactionManager {
|
public class FlexTransactionManager extends AbstractPlatformTransactionManager {
|
||||||
@ -95,17 +96,17 @@ public class FlexTransactionManager extends AbstractPlatformTransactionManager {
|
|||||||
this.prevXid = prevXid;
|
this.prevXid = prevXid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRollbackOnly(){
|
public void setRollbackOnly() {
|
||||||
ROLLBACK_ONLY_XIDS.set(prevXid);
|
ROLLBACK_ONLY_XIDS.set(prevXid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear(){
|
public void clear() {
|
||||||
ROLLBACK_ONLY_XIDS.remove();
|
ROLLBACK_ONLY_XIDS.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRollbackOnly() {
|
public boolean isRollbackOnly() {
|
||||||
return currentXid.equals(ROLLBACK_ONLY_XIDS.get());
|
return currentXid != null && currentXid.equals(ROLLBACK_ONLY_XIDS.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user