当前位置: 首页>>代码示例>>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;未经允许,请勿转载。