Get a session and confirm that it is permitted to perform write operations<br />

@return

@throws ReadOnlyTransactionException
if we cannot perform writes in this session
188196
protected Session getWriteSession()
	{
		final Session session = getSession();

		if (session.isDefaultReadOnly())
		{
			throw new ReadOnlyTransactionException("Cannot perform write operation on " + clazz + " in a read-only transaction");
		}
		else
		{
			return session;
		}
	}
1294441
public CreateTransactionResult createTransaction(
            final long connectionId,
            final long txnId,
            final long uniqueId,
            final StoredProcedureInvocation invocation,
            final boolean isReadOnly,
            final boolean isSinglePartition,
            final boolean isEveryPartition,
            final int partition,
            final int messageSize,
            long nowNanos,
            final boolean isForReplay)
    {
        return m_dispatcher.createTransaction(
                connectionId,
                txnId,
                uniqueId,
                invocation,
                isReadOnly,
                isSinglePartition,
                isEveryPartition,
                new int [] { partition },
                messageSize,
                nowNanos,
                isForReplay);
    }
1328815
protected boolean isExistingTransaction(Object transaction) {
        ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) transaction;

        return super.isExistingTransaction(actualTransactionObject
                .getHibernateTransactionObject());
    }
187218
public Transaction newTransaction()
    {
        if ((getCurrentDatabase() == null))
        {
            throw new DatabaseClosedException("Database is NULL, must have a DB in order to create a transaction");
        }
        TransactionImpl tx = new TransactionImpl(this);
        try
        {
            getConfigurator().configure(tx);
        }
        catch (ConfigurationException e)
        {
            throw new ODMGRuntimeException("Error in configuration of TransactionImpl instance: " + e.getMessage());
        }
        return tx;
    }
1024555
public TransactionImpl getTransaction()
    {
        TxBuffer buf = (TxBuffer) txRepository.get();
        return buf != null ? buf.getInternTx() : null;
    }
1199998
@Override
    public synchronized UserTransaction getUserTransaction()
    {
        // d367572.1 start
        if (state == PRE_CREATE)
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "Incorrect state: " + getStateName(state));
            throw new IllegalStateException(getStateName(state));
        }
        // d367572.1 end

        return UserTransactionWrapper.INSTANCE; // d631349

    }
411974
public Transaction beginTransaction() {
		if (datastoreType == DatastoreType.HIGH_REPLICATION) {
			return datastore.beginTransaction(TransactionOptions.Builder.withXG(true));
		}
		
		return datastore.beginTransaction();
	}
603975
protected Session getReadSession() throws CpoException {
    Session session;

    try {
      if (!(invalidReadSession)) {
        session = getReadDataSource().getSession();
      } else {
        session = getWriteDataSource().getSession();
      }
    } catch (Exception e) {
      invalidReadSession = true;

      String msg = "getReadConnection(): failed";
      logger.error(msg, e);

      session = getWriteSession();
    }

    return session;
  }
1019259
protected SITransaction getTransaction() {

        if (TRACE.isEntryEnabled()) {
            final String methodName = "getTransaction";
            SibTr.entry(this, TRACE, methodName);
            SibTr.exit(this, TRACE, methodName, null);
        }
        return null;

    }
569539
public function transaction() {

		if(null === $this -> connection) {
			$this -> connect();
		}

		$this -> connection -> autocommit(false);
		$this -> connection -> begin_transaction(MYSQLI_TRANS_START_READ_WRITE);

		return $this;
	}
834547
protected HttpSession getSessionFromTransaction(final HttpServletRequest servletRequest, final String txId) {

        final Principal userPrincipal = servletRequest.getUserPrincipal();
        final String userName = userPrincipal == null ? null : userPrincipal.getName();

        final FedoraSession session = batchService.getSession(txId, userName);
        final HttpSession batchSession = new HttpSession(session);
        batchSession.makeBatchSession();
        LOGGER.debug("Returning a session in the batch {} for user {}", batchSession, userName);
        return batchSession;
    }
1283199
function CommitTransaction()
	{
		if ($this->ConnectionSetting->IsReadOnlySlave)
			throw new Exception('Transactions are not allowed on a read-only slave');
		
		$this->RequireConnection(true);
		$this->Observe("DataAdapter ($this->_label) (DataAdapter.CommitTransaction)", OBSERVE_QUERY);
		$this->_transactionInProgress = false;
		return $this->_driver->CommitTransaction($this->_dbconn);
	}
373671
@Override
    public synchronized UserTransaction getUserTransaction() {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "getUserTransaction");

        // Calling getUserTransaction is not allowed from setMessageDrivenContext
        // per the EJB Specification.                                      d159152
        if ((state == PRE_CREATE)) {
            IllegalStateException ise;

            ise = new IllegalStateException("MessageDrivenBean: getUserTransaction " +
                                            "not allowed from state = " +
                                            getStateName(state));
            if (isTraceOn && tc.isDebugEnabled())
                Tr.exit(tc, "getUserTransaction", ise);

            throw ise;
        }

        UserTransaction userTransactionWrapper = UserTransactionWrapper.INSTANCE; // d631349

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "getUserTransaction", userTransactionWrapper);
        return userTransactionWrapper;
    }
400615
public static TransactionContext transactionContext(SharedSessionContractImplementor session) {
		TransactionCoordinator transactionCoordinator = session.getTransactionCoordinator();
		if ( transactionCoordinator != null && transactionCoordinator.getTransactionDriverControl() != null ) {
			TransactionDriver driver = transactionCoordinator.getTransactionDriverControl();
			if ( driver instanceof IdentifiableDriver ) {
				return new TransactionContextImpl( (IdentifiableDriver) driver );
			}
		}
		return EmptyTransactionContext.INSTANCE;
	}
189051
public ServerTransaction getNewServerTransaction(Request request)
			throws TransactionAlreadyExistsException,
			TransactionUnavailableException {

		checkState();
		// TODO: add checks for wrapper

		final SIPServerTransaction st = (SIPServerTransaction) provider.getNewServerTransaction(request);
		ServerTransactionWrapper stw = new ServerTransactionWrapper(st, ra);

		if (stw.getDialogWrapper() == null) {
			// SLEE 1.1 specs: D.4
			// ServerTransaction Activity objects are created automatically when
			// the resource adaptor receives an
			// incoming SIP request. The activity ends when a final response is
			// sent on the ServerTransaction.
			stw.setActivity(true);
			if (!ra.addSuspendedActivity(stw)) {
				throw new TransactionUnavailableException(
						"Failed to create activity.");
			}
		}

		return stw;
	}
113789
@Override
    public EntityTransaction getTransaction()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "em.getTransaction();\n" + toString());

        return getEMInvocationInfo(false).getTransaction();
    }
688164
protected TransactionImpl[] getRecoveringTransactions() {
        TransactionImpl[] recoveredTransactions = new TransactionImpl[_recoveringTransactions.size()];
        _recoveringTransactions.toArray(recoveredTransactions);
        return recoveredTransactions;
    }