當前位置: 首頁>>代碼示例>>Java>>正文


Java CannotGetCciConnectionException類代碼示例

本文整理匯總了Java中org.springframework.jca.cci.CannotGetCciConnectionException的典型用法代碼示例。如果您正苦於以下問題:Java CannotGetCciConnectionException類的具體用法?Java CannotGetCciConnectionException怎麽用?Java CannotGetCciConnectionException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CannotGetCciConnectionException類屬於org.springframework.jca.cci包,在下文中一共展示了CannotGetCciConnectionException類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getConnection

import org.springframework.jca.cci.CannotGetCciConnectionException; //導入依賴的package包/類
/**
 * Obtain a Connection from the given ConnectionFactory. Translates ResourceExceptions
 * into the Spring hierarchy of unchecked generic data access exceptions, simplifying
 * calling code and making any exception that is thrown more meaningful.
 * <p>Is aware of a corresponding Connection bound to the current thread, for example
 * when using {@link CciLocalTransactionManager}. Will bind a Connection to the thread
 * if transaction synchronization is active (e.g. if in a JTA transaction).
 * @param cf the ConnectionFactory to obtain Connection from
 * @param spec the ConnectionSpec for the desired Connection (may be {@code null}).
 * Note: If this is specified, a new Connection will be obtained for every call,
 * without participating in a shared transactional Connection.
 * @return a CCI Connection from the given ConnectionFactory
 * @throws org.springframework.jca.cci.CannotGetCciConnectionException
 * if the attempt to get a Connection failed
 * @see #releaseConnection
 */
public static Connection getConnection(ConnectionFactory cf, ConnectionSpec spec)
		throws CannotGetCciConnectionException {
	try {
		if (spec != null) {
			Assert.notNull(cf, "No ConnectionFactory specified");
			return cf.getConnection(spec);
		}
		else {
			return doGetConnection(cf);
		}
	}
	catch (ResourceException ex) {
		throw new CannotGetCciConnectionException("Could not get CCI Connection", ex);
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:32,代碼來源:ConnectionFactoryUtils.java

示例2: getConnection

import org.springframework.jca.cci.CannotGetCciConnectionException; //導入依賴的package包/類
/**
 * Get a CCI Connection, either from the current transaction or a new one.
 * @return the CCI Connection
 * @throws org.springframework.jca.cci.CannotGetCciConnectionException
 * if the attempt to get a Connection failed
 * @see org.springframework.jca.cci.connection.ConnectionFactoryUtils#getConnection(javax.resource.cci.ConnectionFactory)
 */
protected final Connection getConnection() throws CannotGetCciConnectionException {
	return ConnectionFactoryUtils.getConnection(getConnectionFactory());
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:11,代碼來源:CciDaoSupport.java


注:本文中的org.springframework.jca.cci.CannotGetCciConnectionException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。