org.xblackcat.sjpu.storage.ITx Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sjpu-dbah Show documentation
Show all versions of sjpu-dbah Show documentation
Service for generating DB access logic in simple way via interfaces and annotations
package org.xblackcat.sjpu.storage;
/**
* An instance of the interface holds context of open transactions. All AccessHelpers obtained from the context will be belong to the
* transaction only. Invoke {@linkplain #commit()} method before closing the transaction to fix performed changes. If neither
* {@linkplain #commit()} nor {@linkplain #rollback()} is invoked before {@linkplain #close()} the transaction all changes will be
* reverted automatically on closing. After It is not allowed to obtain new AccessHelper objects after {@linkplain #commit()}
* or {@linkplain #rollback()}.
*
* try (IBatch tx = s.openTransaction()) {
* ISimpleAH ah = tx.get(ISimpleAH.class);
* // do action
* tx.commit();
* }
*
* 15.11.13 14:05
*
* @author xBlackCat
*/
public interface ITx extends IAHFactory, AutoCloseable {
void commit() throws StorageException;
void rollback() throws StorageException;
@Override
void close() throws StorageException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy