com.sap.cds.services.impl.transaction.LocalTransactionManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cds-feature-jdbc Show documentation
Show all versions of cds-feature-jdbc Show documentation
Consuming JDBC persistences using the CDS4j JDBC runtime
/**************************************************************************
* (C) 2019-2024 SAP SE or an SAP affiliate company. All rights reserved. *
**************************************************************************/
package com.sap.cds.services.impl.transaction;
import com.sap.cds.services.transaction.TransactionManager;
import com.sap.cds.transaction.spi.ContainerTransactionManager;
// adapting the cds4j default transaction manager
public class LocalTransactionManager implements TransactionManager {
private final ContainerTransactionManager cds4jTxMgr;
private final String name;
public LocalTransactionManager(String name, ContainerTransactionManager cds4jTxMgr) {
this.name = name;
this.cds4jTxMgr = cds4jTxMgr;
}
@Override
public String getName() {
return name;
}
@Override
public boolean isActive() {
return cds4jTxMgr.isActive();
}
@Override
public void begin() {
cds4jTxMgr.begin();
}
@Override
public void commit() {
cds4jTxMgr.commit();
}
@Override
public void rollback() {
cds4jTxMgr.rollback();
}
@Override
public boolean isRollbackOnly() {
return cds4jTxMgr.isRollbackOnly();
}
@Override
public void setRollbackOnly() {
cds4jTxMgr.setRollbackOnly();
}
}