Java Code Examples for org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorBuilderImpl

The following examples show how to use org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorBuilderImpl. These examples are extracted from open source projects. 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 Project: quarkus   Source File: FastBootMetadataBuilder.java    License: Apache License 2.0 6 votes vote down vote up
private static void applyTransactionProperties(PersistenceUnitDescriptor persistenceUnit,
        Map<String, Object> configurationValues) {
    PersistenceUnitTransactionType transactionType = PersistenceUnitTransactionTypeHelper
            .interpretTransactionType(configurationValues.get(JPA_TRANSACTION_TYPE));
    if (transactionType == null) {
        transactionType = persistenceUnit.getTransactionType();
    }
    if (transactionType == null) {
        // is it more appropriate to have this be based on bootstrap entry point (EE vs SE)?
        transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL;
    }
    boolean hasTransactionStrategy = configurationValues.containsKey(TRANSACTION_COORDINATOR_STRATEGY);
    if (hasTransactionStrategy) {
        LOG.overridingTransactionStrategyDangerous(TRANSACTION_COORDINATOR_STRATEGY);
    } else {
        if (transactionType == PersistenceUnitTransactionType.JTA) {
            configurationValues.put(TRANSACTION_COORDINATOR_STRATEGY,
                    JtaTransactionCoordinatorBuilderImpl.class);
        } else if (transactionType == PersistenceUnitTransactionType.RESOURCE_LOCAL) {
            configurationValues.put(TRANSACTION_COORDINATOR_STRATEGY,
                    JdbcResourceLocalTransactionCoordinatorBuilderImpl.class);
        }
    }
}
 
Example 2
private void applyTransactionProperties(StandardServiceRegistryBuilder ssrBuilder) {
	PersistenceUnitTransactionType txnType = PersistenceUnitTransactionTypeHelper.interpretTransactionType(
			configurationValues.get( JPA_TRANSACTION_TYPE )
	);
	if ( txnType == null ) {
		txnType = persistenceUnit.getTransactionType();
	}
	if ( txnType == null ) {
		// is it more appropriate to have this be based on bootstrap entry point (EE vs SE)?
		txnType = PersistenceUnitTransactionType.RESOURCE_LOCAL;
	}
	boolean hasTxStrategy = configurationValues.containsKey( TRANSACTION_COORDINATOR_STRATEGY );
	if ( hasTxStrategy ) {
		LOG.overridingTransactionStrategyDangerous( TRANSACTION_COORDINATOR_STRATEGY );
	}
	else {
		if ( txnType == PersistenceUnitTransactionType.JTA ) {
			ssrBuilder.applySetting( TRANSACTION_COORDINATOR_STRATEGY, JtaTransactionCoordinatorBuilderImpl.class );
		}
		else if ( txnType == PersistenceUnitTransactionType.RESOURCE_LOCAL ) {
			ssrBuilder.applySetting( TRANSACTION_COORDINATOR_STRATEGY, JdbcResourceLocalTransactionCoordinatorBuilderImpl.class );
		}
	}
}
 
Example 3
Source Project: quarkus   Source File: QuarkusStrategySelectorBuilder.java    License: Apache License 2.0 5 votes vote down vote up
private static void addTransactionCoordinatorBuilders(StrategySelectorImpl strategySelector) {
    strategySelector.registerStrategyImplementor(
            TransactionCoordinatorBuilder.class,
            JdbcResourceLocalTransactionCoordinatorBuilderImpl.SHORT_NAME,
            JdbcResourceLocalTransactionCoordinatorBuilderImpl.class);
    strategySelector.registerStrategyImplementor(
            TransactionCoordinatorBuilder.class,
            JtaTransactionCoordinatorBuilderImpl.SHORT_NAME,
            JtaTransactionCoordinatorBuilderImpl.class);
}
 
Example 4
@Override
public TransactionCoordinatorBuilder initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
	return registry.getService( StrategySelector.class ).resolveDefaultableStrategy(
			TransactionCoordinatorBuilder.class,
			determineStrategySelection( configurationValues ),
			JdbcResourceLocalTransactionCoordinatorBuilderImpl.INSTANCE
	);
}
 
Example 5
Source Project: lams   Source File: StrategySelectorBuilder.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void addTransactionCoordinatorBuilders(StrategySelectorImpl strategySelector) {
	strategySelector.registerStrategyImplementor(
			TransactionCoordinatorBuilder.class,
			JdbcResourceLocalTransactionCoordinatorBuilderImpl.SHORT_NAME,
			JdbcResourceLocalTransactionCoordinatorBuilderImpl.class
	);
	strategySelector.registerStrategyImplementor(
			TransactionCoordinatorBuilder.class,
			JtaTransactionCoordinatorBuilderImpl.SHORT_NAME,
			JtaTransactionCoordinatorBuilderImpl.class
	);

	// add the legacy TransactionFactory impl names...
	strategySelector.registerStrategyImplementor(
			TransactionCoordinatorBuilder.class,
			"org.hibernate.transaction.JDBCTransactionFactory",
			JdbcResourceLocalTransactionCoordinatorBuilderImpl.class
	);
	strategySelector.registerStrategyImplementor(
			TransactionCoordinatorBuilder.class,
			"org.hibernate.transaction.JTATransactionFactory",
			JtaTransactionCoordinatorBuilderImpl.class
	);
	strategySelector.registerStrategyImplementor(
			TransactionCoordinatorBuilder.class,
			"org.hibernate.transaction.CMTTransactionFactory",
			JtaTransactionCoordinatorBuilderImpl.class
	);
}