本文整理汇总了Java中org.hibernate.engine.transaction.spi.LocalStatus类的典型用法代码示例。如果您正苦于以下问题:Java LocalStatus类的具体用法?Java LocalStatus怎么用?Java LocalStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocalStatus类属于org.hibernate.engine.transaction.spi包,在下文中一共展示了LocalStatus类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doRollback
import org.hibernate.engine.transaction.spi.LocalStatus; //导入依赖的package包/类
@Override
protected void doRollback() {
try {
if ( isInitiator ) {
// failed commits automatically rollback the transaction per JTA spec
if ( getLocalStatus() != LocalStatus.FAILED_COMMIT ) {
userTransaction.rollback();
LOG.debug( "Rolled back JTA UserTransaction" );
}
}
else {
markRollbackOnly();
}
}
catch ( Exception e ) {
throw new TransactionException( "JTA rollback failed", e );
}
}
示例2: isActive
import org.hibernate.engine.transaction.spi.LocalStatus; //导入依赖的package包/类
@Override
public boolean isActive() throws HibernateException {
if ( getLocalStatus() != LocalStatus.ACTIVE ) {
return false;
}
final int status;
try {
status = userTransaction.getStatus();
}
catch ( SystemException se ) {
throw new TransactionException( "Could not determine transaction status: ", se );
}
return JtaStatusHelper.isActive( status );
}
示例3: getSession
import org.hibernate.engine.transaction.spi.LocalStatus; //导入依赖的package包/类
@Override
public Session getSession(){
session = sessionFactory.getCurrentSession();
if(session == null){
this.session = sessionFactory.openSession();
LOG.debug("Session opened");
}
if(session != null && !(session.getTransaction().getLocalStatus().equals(LocalStatus.ACTIVE))){
session.beginTransaction();
LOG.debug("Begining Transaction");
}
return this.session;
}
示例4: isActive
import org.hibernate.engine.transaction.spi.LocalStatus; //导入依赖的package包/类
@Override
public boolean isActive() throws HibernateException {
return getLocalStatus() == LocalStatus.ACTIVE;
}
示例5: getLocalStatus
import org.hibernate.engine.transaction.spi.LocalStatus; //导入依赖的package包/类
/**
* Get the current local status of this transaction.
* <p/>
* This only accounts for the local view of the transaction status. In other words it does not check the status
* of the actual underlying transaction.
*
* @return The current local status.
*/
public LocalStatus getLocalStatus();