Example usage for org.springframework.transaction TransactionDefinition ISOLATION_DEFAULT

List of usage examples for org.springframework.transaction TransactionDefinition ISOLATION_DEFAULT

Introduction

In this page you can find the example usage for org.springframework.transaction TransactionDefinition ISOLATION_DEFAULT.

Prototype

int ISOLATION_DEFAULT

To view the source code for org.springframework.transaction TransactionDefinition ISOLATION_DEFAULT.

Click Source Link

Document

Use the default isolation level of the underlying datastore.

Usage

From source file:com.netsteadfast.greenstep.bsc.util.MeasureDataCalendarUtils.java

/**
 *  method ? Expression , ??LogicService ? Transaction
 * //from  w  ww  . j a v  a2 s  . c o  m
 * @param kpiId
 * @param date
 * @param frequency
 * @param orgaId
 * @param emplId
 * @return
 * @throws ServiceException
 * @throws Exception
 */
@SuppressWarnings("rawtypes")
public static MeasureDataVO findMeasureData(String kpiId, String date, String frequency, String orgaId,
        String emplId) throws ServiceException, Exception {

    transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
    transactionTemplate.setIsolationLevel(TransactionDefinition.ISOLATION_DEFAULT);
    transactionTemplate.setReadOnly(true);
    MeasureDataVO measureData = null;
    try {
        measureData = (MeasureDataVO) transactionTemplate.execute(new TransactionCallback() {

            @Override
            public Object doInTransaction(TransactionStatus status) {
                MeasureDataVO value = new MeasureDataVO();
                value.setKpiId(kpiId);
                value.setDate(date);
                value.setFrequency(frequency);
                value.setOrgId(orgaId);
                value.setEmpId(emplId);
                try {
                    DefaultResult<MeasureDataVO> mdResult = measureDataService.findByUK(value);
                    if (mdResult.getValue() != null) {
                        value = mdResult.getValue();
                    } else {
                        value = null;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    value = null;
                }
                return value;
            }

        });
    } catch (Exception e) {
        throw e;
    }
    return measureData;
}

From source file:com.wakacommerce.common.util.StreamingTransactionCapableUtil.java

@Override
public <G extends Throwable> void runStreamingTransactionalOperation(
        final StreamCapableTransactionalOperation streamOperation, Class<G> exceptionType) throws G {
    runStreamingTransactionalOperation(streamOperation, exceptionType,
            TransactionDefinition.PROPAGATION_REQUIRED, TransactionDefinition.ISOLATION_DEFAULT);
}

From source file:com.wakacommerce.common.util.StreamingTransactionCapableUtil.java

@Override
public <G extends Throwable> void runTransactionalOperation(StreamCapableTransactionalOperation operation,
        Class<G> exceptionType) throws G {
    runTransactionalOperation(operation, exceptionType, TransactionDefinition.PROPAGATION_REQUIRED,
            TransactionDefinition.ISOLATION_DEFAULT);
}

From source file:com.wakacommerce.common.util.StreamingTransactionCapableUtil.java

@Override
public <G extends Throwable> void runOptionalTransactionalOperation(
        StreamCapableTransactionalOperation operation, Class<G> exceptionType, boolean useTransaction)
        throws G {
    runOptionalTransactionalOperation(operation, exceptionType, useTransaction,
            TransactionDefinition.PROPAGATION_REQUIRED, TransactionDefinition.ISOLATION_DEFAULT);
}

From source file:jp.terasoluna.fw.batch.util.BatchUtilTest.java

/**
 * testGetTransactionDefinition02//from   w w w  .  j  av a 2s  .  c  o  m
 * @throws Exception
 */
@Test
public void testGetTransactionDefinition02() throws Exception {

    // 
    TransactionDefinition result = BatchUtil.getTransactionDefinition(
            TransactionDefinition.PROPAGATION_REQUIRED, TransactionDefinition.ISOLATION_DEFAULT,
            TransactionDefinition.TIMEOUT_DEFAULT, false);

    // ?
    assertNotNull(result);
}

From source file:jp.terasoluna.fw.batch.util.BatchUtilTest.java

/**
 * testStartTransaction04/*from  ww  w.j  a  va  2  s  . com*/
 * @throws Exception
 */
@Test
public void testStartTransaction04() throws Exception {
    // 
    PlatformTransactionManager tran = new PlatformTransactionManagerStub();

    // 
    TransactionStatus result = BatchUtil.startTransaction(tran, TransactionDefinition.PROPAGATION_REQUIRED,
            TransactionDefinition.ISOLATION_DEFAULT, TransactionDefinition.TIMEOUT_DEFAULT, false);

    // ?
    assertNotNull(result);
}

From source file:jp.terasoluna.fw.batch.util.BatchUtilTest.java

/**
 * testStartTransaction05/*from  ww w  .j a v a  2  s  . c  om*/
 * @throws Exception
 */
@Test
public void testStartTransaction05() throws Exception {
    // 
    PlatformTransactionManager tran = new PlatformTransactionManagerStub();

    // 
    TransactionStatus result = BatchUtil.startTransaction(tran, TransactionDefinition.PROPAGATION_REQUIRED,
            TransactionDefinition.ISOLATION_DEFAULT, TransactionDefinition.TIMEOUT_DEFAULT, false, log);

    // ?
    assertNotNull(result);
}

From source file:org.alfresco.repo.transaction.TransactionServiceImpl.java

/**
 * @see org.springframework.transaction.TransactionDefinition#PROPAGATION_REQUIRED
 *///from   w w w. j  a v  a 2s.co m
public UserTransaction getUserTransaction(boolean readOnly, boolean ignoreSystemReadOnly) {
    if (ignoreSystemReadOnly) {
        SpringAwareUserTransaction txn = new SpringAwareUserTransaction(transactionManager, (readOnly),
                TransactionDefinition.ISOLATION_DEFAULT, TransactionDefinition.PROPAGATION_REQUIRED,
                TransactionDefinition.TIMEOUT_DEFAULT);
        return txn;
    } else {
        SpringAwareUserTransaction txn = new SpringAwareUserTransaction(transactionManager,
                (readOnly | isReadOnly()), TransactionDefinition.ISOLATION_DEFAULT,
                TransactionDefinition.PROPAGATION_REQUIRED, TransactionDefinition.TIMEOUT_DEFAULT);
        return txn;
    }
}

From source file:org.alfresco.repo.transaction.TransactionServiceImpl.java

/**
 * @see org.springframework.transaction.TransactionDefinition#PROPAGATION_REQUIRES_NEW
 *//*  w w  w  .  j a  v a  2s  .  c  o m*/
@Override
public UserTransaction getNonPropagatingUserTransaction(boolean readOnly, boolean ignoreSystemReadOnly) {
    if (ignoreSystemReadOnly) {
        SpringAwareUserTransaction txn = new SpringAwareUserTransaction(transactionManager, (readOnly),
                TransactionDefinition.ISOLATION_DEFAULT, TransactionDefinition.PROPAGATION_REQUIRES_NEW,
                TransactionDefinition.TIMEOUT_DEFAULT);
        return txn;
    } else {
        SpringAwareUserTransaction txn = new SpringAwareUserTransaction(transactionManager,
                (readOnly | isReadOnly()), TransactionDefinition.ISOLATION_DEFAULT,
                TransactionDefinition.PROPAGATION_REQUIRES_NEW, TransactionDefinition.TIMEOUT_DEFAULT);
        return txn;
    }
}

From source file:org.broadleafcommerce.common.util.TransactionUtils.java

public static TransactionStatus createTransaction(String name, int propagationBehavior,
        PlatformTransactionManager transactionManager, boolean isReadOnly) {
    return createTransaction(name, propagationBehavior, TransactionDefinition.ISOLATION_DEFAULT,
            transactionManager, isReadOnly);
}