Java Code Examples for org.springframework.transaction.TransactionDefinition#ISOLATION_READ_COMMITTED

The following examples show how to use org.springframework.transaction.TransactionDefinition#ISOLATION_READ_COMMITTED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheSpringStoreSessionListener.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Gets DB transaction isolation level based on ongoing cache transaction isolation.
 *
 * @param isolation Cache transaction isolation.
 * @return DB transaction isolation.
 */
private int isolationLevel(TransactionIsolation isolation) {
    switch (isolation) {
        case READ_COMMITTED:
            return TransactionDefinition.ISOLATION_READ_COMMITTED;

        case REPEATABLE_READ:
            return TransactionDefinition.ISOLATION_REPEATABLE_READ;

        case SERIALIZABLE:
            return TransactionDefinition.ISOLATION_SERIALIZABLE;

        default:
            throw new IllegalStateException(); // Will never happen.
    }
}
 
Example 2
Source File: DefaultJdoDialect.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Determine the JDO isolation level String to use for the given
 * Spring transaction definition.
 * @param definition the Spring transaction definition
 * @return the corresponding JDO isolation level String, or {@code null}
 * to indicate that no isolation level should be set explicitly
 * @see Transaction#setIsolationLevel(String)
 * @see Constants#TX_SERIALIZABLE
 * @see Constants#TX_REPEATABLE_READ
 * @see Constants#TX_READ_COMMITTED
 * @see Constants#TX_READ_UNCOMMITTED
 */
protected String getJdoIsolationLevel(TransactionDefinition definition) {
	switch (definition.getIsolationLevel()) {
		case TransactionDefinition.ISOLATION_SERIALIZABLE:
			return Constants.TX_SERIALIZABLE;
		case TransactionDefinition.ISOLATION_REPEATABLE_READ:
			return Constants.TX_REPEATABLE_READ;
		case TransactionDefinition.ISOLATION_READ_COMMITTED:
			return Constants.TX_READ_COMMITTED;
		case TransactionDefinition.ISOLATION_READ_UNCOMMITTED:
			return Constants.TX_READ_UNCOMMITTED;
		default:
			return null;
	}
}
 
Example 3
Source File: DefaultJdoDialect.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Determine the JDO isolation level String to use for the given
 * Spring transaction definition.
 * @param definition the Spring transaction definition
 * @return the corresponding JDO isolation level String, or {@code null}
 * to indicate that no isolation level should be set explicitly
 * @see Transaction#setIsolationLevel(String)
 * @see Constants#TX_SERIALIZABLE
 * @see Constants#TX_REPEATABLE_READ
 * @see Constants#TX_READ_COMMITTED
 * @see Constants#TX_READ_UNCOMMITTED
 */
protected String getJdoIsolationLevel(TransactionDefinition definition) {
	switch (definition.getIsolationLevel()) {
		case TransactionDefinition.ISOLATION_SERIALIZABLE:
			return Constants.TX_SERIALIZABLE;
		case TransactionDefinition.ISOLATION_REPEATABLE_READ:
			return Constants.TX_REPEATABLE_READ;
		case TransactionDefinition.ISOLATION_READ_COMMITTED:
			return Constants.TX_READ_COMMITTED;
		case TransactionDefinition.ISOLATION_READ_UNCOMMITTED:
			return Constants.TX_READ_UNCOMMITTED;
		default:
			return null;
	}
}
 
Example 4
Source File: SpringTransactionManager.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param isolationLevel Spring isolation level.
 * @return Ignite isolation level.
 */
private TransactionIsolation convertToIgniteIsolationLevel(int isolationLevel) {
    TransactionIsolation isolation = ignite.configuration().getTransactionConfiguration().getDefaultTxIsolation();
    switch (isolationLevel) {
        case TransactionDefinition.ISOLATION_READ_COMMITTED:
            isolation = TransactionIsolation.READ_COMMITTED;
            break;
        case TransactionDefinition.ISOLATION_REPEATABLE_READ:
            isolation = TransactionIsolation.REPEATABLE_READ;
            break;
        case TransactionDefinition.ISOLATION_SERIALIZABLE:
            isolation = TransactionIsolation.SERIALIZABLE;
    }
    return isolation;
}