/** * Apply the given transaction isolation level. The default implementation * will throw an exception for any level other than ISOLATION_DEFAULT. * <p>To be overridden in subclasses for specific JTA implementations, * as alternative to overriding the full {@link #doJtaBegin} method. * @param txObject the JtaTransactionObject containing the UserTransaction * @param isolationLevel isolation level taken from transaction definition * @throws InvalidIsolationLevelException if the given isolation level * cannot be applied * @throws SystemException if thrown by the JTA implementation * @see #doJtaBegin * @see JtaTransactionObject#getUserTransaction() * @see #getTransactionManager() */ protected void applyIsolationLevel(JtaTransactionObject txObject, int isolationLevel) throws InvalidIsolationLevelException, SystemException { if (!this.allowCustomIsolationLevels && isolationLevel != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException( "JtaTransactionManager does not support custom isolation levels by default - " + "switch 'allowCustomIsolationLevels' to 'true'"); } }
/** * Apply the given transaction isolation level. The default implementation * will throw an exception for any level other than ISOLATION_DEFAULT. * <p>To be overridden in subclasses for specific JTA implementations, * as alternative to overriding the full {@link #doJtaBegin} method. * @param txObject the JtaTransactionObject containing the UserTransaction * @param isolationLevel isolation level taken from transaction definition * @throws InvalidIsolationLevelException if the given isolation level * cannot be applied * @throws SystemException if thrown by the JTA implementation * @see #doJtaBegin * @see JtaTransactionObject#getUserTransaction() * @see #getTransactionManager() */ protected void applyIsolationLevel(JtaTransactionObject txObject, int isolationLevel) throws InvalidIsolationLevelException, SystemException { if (!this.allowCustomIsolationLevels && isolationLevel != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException( "JtaTransactionManager does not support custom isolation levels by default - " + "switch 'allowCustomIsolationLevels' to 'true'"); } }
/** * This implementation invokes the standard JPA {@code Transaction.begin} * method. Throws an InvalidIsolationLevelException if a non-default isolation * level is set. * <p>This implementation does not return any transaction data Object, since there * is no state to be kept for a standard JPA transaction. Hence, subclasses do not * have to care about the return value ({@code null}) of this implementation * and are free to return their own transaction data Object. * @see javax.persistence.EntityTransaction#begin * @see org.springframework.transaction.InvalidIsolationLevelException * @see #cleanupTransaction */ @Override @Nullable public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition) throws PersistenceException, SQLException, TransactionException { if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException(getClass().getSimpleName() + " does not support custom isolation levels due to limitations in standard JPA. " + "Specific arrangements may be implemented in custom JpaDialect variants."); } entityManager.getTransaction().begin(); return null; }
/** * This implementation invokes the standard JPA {@code Transaction.begin} * method. Throws an InvalidIsolationLevelException if a non-default isolation * level is set. * <p>This implementation does not return any transaction data Object, since there * is no state to be kept for a standard JPA transaction. Hence, subclasses do not * have to care about the return value ({@code null}) of this implementation * and are free to return their own transaction data Object. * @see javax.persistence.EntityTransaction#begin * @see org.springframework.transaction.InvalidIsolationLevelException * @see #cleanupTransaction */ @Override @Nullable public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition) throws PersistenceException, SQLException, TransactionException { if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException(getClass().getSimpleName() + " does not support custom isolation levels due to limitations in standard JPA. " + "Specific arrangements may be implemented in custom JpaDialect variants."); } entityManager.getTransaction().begin(); return null; }
@Override protected void doBegin(Object transaction, TransactionDefinition definition) { if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException("JMS does not support an isolation level concept");
throw new InvalidIsolationLevelException(getClass().getSimpleName() + " does not support custom isolation levels since the 'prepareConnection' flag is off.");
throw new InvalidIsolationLevelException(getClass().getSimpleName() + " does not support custom isolation levels since the 'prepareConnection' flag is off.");
throw new InvalidIsolationLevelException( "HibernateTransactionManager is not allowed to support custom isolation levels: " + "make sure that its 'prepareConnection' flag is on (the default) and that the " +
/** {@inheritDoc} */ @Override protected void doBegin(Object transaction, TransactionDefinition definition) throws TransactionException { if (definition.getIsolationLevel() == TransactionDefinition.ISOLATION_READ_UNCOMMITTED) throw new InvalidIsolationLevelException("Ignite does not support READ_UNCOMMITTED isolation level."); IgniteTransactionObject txObj = (IgniteTransactionObject)transaction; Transaction tx = null; try { if (txObj.getTransactionHolder() == null || txObj.getTransactionHolder().isSynchronizedWithTransaction()) { long timeout = ignite.configuration().getTransactionConfiguration().getDefaultTxTimeout(); if (definition.getTimeout() > 0) timeout = TimeUnit.SECONDS.toMillis(definition.getTimeout()); Transaction newTx = ignite.transactions().txStart(transactionConcurrency, convertToIgniteIsolationLevel(definition.getIsolationLevel()), timeout, 0); if (log.isDebugEnabled()) log.debug("Started Ignite transaction: " + newTx); txObj.setTransactionHolder(new IgniteTransactionHolder(newTx), true); } txObj.getTransactionHolder().setSynchronizedWithTransaction(true); txObj.getTransactionHolder().setTransactionActive(true); tx = txObj.getTransactionHolder().getTransaction(); // Bind the session holder to the thread. if (txObj.isNewTransactionHolder()) TransactionSynchronizationManager.bindResource(this.ignite, txObj.getTransactionHolder()); } catch (Exception ex) { if (tx != null) tx.close(); throw new CannotCreateTransactionException("Could not create Ignite transaction", ex); } }
throw new InvalidIsolationLevelException( "HibernateTransactionManager is not allowed to support custom isolation levels: " + "make sure that its 'prepareConnection' flag is on (the default) and that the " +
@Override protected void doBegin(Object transaction, TransactionDefinition definition) { if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException("Apache Kafka does not support an isolation level concept"); } @SuppressWarnings(UNCHECKED) KafkaTransactionObject<K, V> txObject = (KafkaTransactionObject<K, V>) transaction; KafkaResourceHolder<K, V> resourceHolder = null; try { resourceHolder = ProducerFactoryUtils.getTransactionalResourceHolder(getProducerFactory()); if (logger.isDebugEnabled()) { logger.debug("Created Kafka transaction on producer [" + resourceHolder.getProducer() + "]"); } txObject.setResourceHolder(resourceHolder); txObject.getResourceHolder().setSynchronizedWithTransaction(true); int timeout = determineTimeout(definition); if (timeout != TransactionDefinition.TIMEOUT_DEFAULT) { txObject.getResourceHolder().setTimeoutInSeconds(timeout); } } catch (Exception ex) { if (resourceHolder != null) { ProducerFactoryUtils.releaseResources(resourceHolder); } throw new CannotCreateTransactionException("Could not create Kafka transaction", ex); } }
protected void applyIsolationLevel(JiniTransactionObject txObject, int isolationLevel) throws InvalidIsolationLevelException, SystemException { if (isolationLevel != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException( "JiniTransactionManager does not support custom isolation levels"); } }
/** * Apply the given transaction isolation level. Default implementation * will throw an exception for any level other than ISOLATION_DEFAULT. * <p>To be overridden in subclasses for specific JTA implementations, * as alternative to overriding the full <code>doJtaBegin</code> method. * @param txObject the JtaTransactionObject containing the UserTransaction * @param isolationLevel isolation level taken from transaction definition * @throws InvalidIsolationLevelException if the given isolation level * cannot be applied * @throws SystemException if thrown by the JTA implementation * @see #doJtaBegin * @see JtaTransactionObject#getUserTransaction() * @see #getTransactionManager() */ protected void applyIsolationLevel(JtaTransactionObject txObject, int isolationLevel) throws InvalidIsolationLevelException, SystemException { if (isolationLevel != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException( "JtaTransactionManager does not support custom isolation levels"); } }
/** * Apply the given transaction isolation level. The default implementation * will throw an exception for any level other than ISOLATION_DEFAULT. * <p>To be overridden in subclasses for specific JTA implementations, * as alternative to overriding the full {@link #doJtaBegin} method. * @param txObject the JtaTransactionObject containing the UserTransaction * @param isolationLevel isolation level taken from transaction definition * @throws InvalidIsolationLevelException if the given isolation level * cannot be applied * @throws SystemException if thrown by the JTA implementation * @see #doJtaBegin * @see JtaTransactionObject#getUserTransaction() * @see #getTransactionManager() */ protected void applyIsolationLevel(JtaTransactionObject txObject, int isolationLevel) throws InvalidIsolationLevelException, SystemException { if (!this.allowCustomIsolationLevels && isolationLevel != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException( "JtaTransactionManager does not support custom isolation levels by default - " + "switch 'allowCustomIsolationLevels' to 'true'"); } }
/** * Apply the given transaction isolation level. The default implementation * will throw an exception for any level other than ISOLATION_DEFAULT. * <p>To be overridden in subclasses for specific JTA implementations, * as alternative to overriding the full {@link #doJtaBegin} method. * @param txObject the JtaTransactionObject containing the UserTransaction * @param isolationLevel isolation level taken from transaction definition * @throws InvalidIsolationLevelException if the given isolation level * cannot be applied * @throws SystemException if thrown by the JTA implementation * @see #doJtaBegin * @see JtaTransactionObject#getUserTransaction() * @see #getTransactionManager() */ protected void applyIsolationLevel(JtaTransactionObject txObject, int isolationLevel) throws InvalidIsolationLevelException, SystemException { if (!this.allowCustomIsolationLevels && isolationLevel != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException( "JtaTransactionManager does not support custom isolation levels by default - " + "switch 'allowCustomIsolationLevels' to 'true'"); } }
throw new InvalidIsolationLevelException( "Neo4jTransactionManager is not allowed to support custom isolation levels.");
/** * This implementation invokes the standard JPA {@code Transaction.begin} * method. Throws an InvalidIsolationLevelException if a non-default isolation * level is set. * <p>This implementation does not return any transaction data Object, since there * is no state to be kept for a standard JPA transaction. Hence, subclasses do not * have to care about the return value ({@code null}) of this implementation * and are free to return their own transaction data Object. * @see javax.persistence.EntityTransaction#begin * @see org.springframework.transaction.InvalidIsolationLevelException * @see #cleanupTransaction */ @Override @Nullable public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition) throws PersistenceException, SQLException, TransactionException { if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException(getClass().getSimpleName() + " does not support custom isolation levels due to limitations in standard JPA. " + "Specific arrangements may be implemented in custom JpaDialect variants."); } entityManager.getTransaction().begin(); return null; }
/** * This implementation invokes the standard JDO <code>Transaction.begin</code> * method. Throws an InvalidIsolationLevelException if a non-default isolation * level is set. * @see javax.jdo.Transaction#begin * @see org.springframework.transaction.InvalidIsolationLevelException */ public Object beginTransaction(Transaction transaction, TransactionDefinition definition) throws JDOException, SQLException, TransactionException { if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException( "Standard JDO does not support custom isolation levels: " + "use a special JdoDialect implementation for your JDO provider"); } transaction.begin(); return null; }
/** * This implementation invokes the standard Castor JDO <code>Database.begin()</code> * method. Throws an InvalidIsolationLevelException if a non-default isolation * level is set. * @param database The Castor Database to start a transaction with. * @param definition A Transaction definition * @return Nothing in this case. * @throws PersistenceException If the transaction cannot be started. * @throws TransactionException If the transaction cannot be started. * @see Database#begin * @see org.springframework.transaction.InvalidIsolationLevelException */ public Object beginTransaction(Database database, TransactionDefinition definition) throws PersistenceException, TransactionException { if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException( "Standard Castor JDO does not support custom isolation levels."); } database.begin(); return null; }
@Override protected void doBegin(Object transaction, TransactionDefinition definition) { if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) { throw new InvalidIsolationLevelException("JMS does not support an isolation level concept");