
cn.icuter.jsql.transaction.Transaction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsql Show documentation
Show all versions of jsql Show documentation
JDBC framework for writing sql like java programing
package cn.icuter.jsql.transaction;
import cn.icuter.jsql.exception.JSQLException;
/**
* @author edward
* @since 2018-09-15
*/
public interface Transaction {
enum State {
ROLLBACK,
ROLLBACK_SAVEPOINT,
COMMIT,
ERROR,
RELEASE_SAVEPOINT_ERROR,
ADD_SAVEPOINT_ERROR,
COMMIT_ERROR,
ROLLBACK_ERROR,
ROLLBACK_SAVEPOINT_ERROR,
}
boolean wasCommitted();
boolean wasRolledBack();
State getState();
void commit() throws JSQLException;
void rollback() throws JSQLException;
void addSavepoint(String name) throws JSQLException;
void rollback(String savePointName) throws JSQLException;
/**
*
* Release a savepoint by name in transaction that is before commit/rollback
*
* Note
* Savepoint should be released after transaction end with commit/rollback operation
* Refer to mysql docs RELEASE SAVEPOINT
* > All savepoints of the current transaction are deleted if you execute a COMMIT, or a ROLLBACK that does not name a savepoint.
*
* Refer to oracle docs SAVEPOINT Statement
* > A simple rollback or commit erases all savepoints.
*
* @param savePointName savepoint's name
* @throws JSQLException try to release specified savepoint, error occurs will throw JSQLException
*/
void releaseSavepoint(String savePointName) throws JSQLException;
/**
*
* Release all savepoint in transaction that is before commit/rollback
*
* Note
* Savepoint should be released after transaction end with commit/rollback operation
* Refer to mysql docs RELEASE SAVEPOINT
* > All savepoints of the current transaction are deleted if you execute a COMMIT, or a ROLLBACK that does not name a savepoint.
*
* Refer to oracle docs SAVEPOINT Statement
* > A simple rollback or commit erases all savepoints.
*
*
* @throws JSQLException try to release all savepoint, error occurs will throw JSQLException
*/
void releaseAllSavepoints() throws JSQLException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy