Spring Framework ConnectionHolder - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework ConnectionHolder class.

This code example shows how to use the following methods:getConnection
 
		if (connectionHolder == null) {
			return null; 
		} 
		else { 
			return connectionHolder.getConnection();
		} 
	} 
 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getConnection
 
		if (conHolder == null) {
			throw new IllegalStateException("It seems not to be existing a transaction.");
		} 
 
		return conHolder.getConnection();
	} 
 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getConnection
        try 
        { 
            txn.begin();
            // Dig the proxy out of ... somewhere 
            ConnectionHolder conHolder = (ConnectionHolder) TransactionSynchronizationManager.getResource(dataSource);
            connection = conHolder.getConnection();
            txn.commit();
        } 
        catch (Throwable e)
        { 
            try { txn.rollback(); } catch (Throwable ee) {}
            throw e;
        } 
        // Now mess with the connection, which is protected by the Hibernate wrapper 
        try 
        { 
            connection.commit();
            fail("Use case should have generated a HibernateException");
        } 
        catch (HibernateException e)
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:isSynchronizedWithTransaction
   
  private void clearTransactionInfo() 
  { 
    ConnectionHolder conHolder = (ConnectionHolder) TransactionSynchronizationManager.getResource(this); 
    if (conHolder != null && conHolder. 
      isSynchronizedWithTransaction()) 
    { 
      TransactionSynchronizationManager.unbindResourceIfPossible(this); 
    } 
  } 
 
  public DataSource getInnerDataSource() 
  { 
    return innerDataSource; 
  } 
 
  public void setInnerDataSource(DataSource innerDataSource) 
  { 
    this.innerDataSource = innerDataSource; 
    clearTransactionInfo(); 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Spring Framework ConnectionHolder Methods: