public class DbJtxResourceManager extends java.lang.Object implements JtxResourceManager<DbSession>
JtxResourceManager
manages life-cycle of DbSession
resources.
Also acts as an adapter of resource object (of any type) and JTX engine.
Transaction resources may be of any type. The only thing what is important is that resource must be aware of its transactional state - is it in no-transactional mode (i.e. auto-commit), or under the transaction.
Modifier and Type | Field and Description |
---|---|
protected ConnectionProvider |
connectionProvider |
Constructor and Description |
---|
DbJtxResourceManager(ConnectionProvider connectionProvider)
Creates resource manager.
|
Modifier and Type | Method and Description |
---|---|
DbSession |
beginTransaction(JtxTransactionMode jtxMode,
boolean active)
Creates new resource and begins new transaction if specified so by
active flag, usually determined by propagation behavior.
|
void |
close()
Closes manager and free its resources.
|
void |
commitTransaction(DbSession resource)
Commits resource and closes it if committing was successful.
|
java.lang.Class<DbSession> |
getResourceType()
Returns associated resource type.
|
void |
rollbackTransaction(DbSession resource)
Rollback resource and closes it.
|
protected final ConnectionProvider connectionProvider
public DbJtxResourceManager(ConnectionProvider connectionProvider)
public java.lang.Class<DbSession> getResourceType()
getResourceType
in interface JtxResourceManager<DbSession>
public DbSession beginTransaction(JtxTransactionMode jtxMode, boolean active)
beginTransaction
in interface JtxResourceManager<DbSession>
public void commitTransaction(DbSession resource)
commitTransaction
in interface JtxResourceManager<DbSession>
public void rollbackTransaction(DbSession resource)
rollbackTransaction
in interface JtxResourceManager<DbSession>
public void close()
close
in interface JtxResourceManager<DbSession>
Copyright © 2003-present Jodd Team