| Modifier and Type | Method and Description |
|---|---|
List<Command> |
findByGlobalTxIdAndStatus(String globalTxId,
String status) |
List<Command> |
findFirstGroupByGlobalTxIdWithoutPendingOrderByIdDesc() |
void |
updateStatusByGlobalTxIdAndLocalTxId(String status,
String globalTxId,
String localTxId) |
void |
updateStatusByGlobalTxIdAndLocalTxId(String fromStatus,
String toStatus,
String globalTxId,
String localTxId) |
@Modifying(clearAutomatically=true)
@Query(value="UPDATE org.apache.servicecomb.saga.alpha.core.Command c SET c.status = :toStatus WHERE c.globalTxId = :globalTxId AND c.localTxId = :localTxId AND c.status = :fromStatus")
void updateStatusByGlobalTxIdAndLocalTxId(@Param(value="fromStatus")
String fromStatus,
@Param(value="toStatus")
String toStatus,
@Param(value="globalTxId")
String globalTxId,
@Param(value="localTxId")
String localTxId)
@Modifying(clearAutomatically=true)
@Query(value="UPDATE org.apache.servicecomb.saga.alpha.core.Command c SET c.status = :status WHERE c.globalTxId = :globalTxId AND c.localTxId = :localTxId")
void updateStatusByGlobalTxIdAndLocalTxId(@Param(value="status")
String status,
@Param(value="globalTxId")
String globalTxId,
@Param(value="localTxId")
String localTxId)
@Lock(value=OPTIMISTIC)
@Query(value="SELECT * FROM Command AS c WHERE c.eventId IN ( SELECT MAX(c1.eventId) FROM Command AS c1 INNER JOIN Command AS c2 on c1.globalTxId = c2.globalTxId WHERE c1.status = \'NEW\' GROUP BY c1.globalTxId HAVING MAX( CASE c2.status WHEN \'PENDING\' THEN 1 ELSE 0 END ) = 0) ORDER BY c.eventId ASC LIMIT 1",
nativeQuery=true)
List<Command> findFirstGroupByGlobalTxIdWithoutPendingOrderByIdDesc()
Copyright © 2017–2018 The Apache Software Foundation. All rights reserved.