当前位置: 首页>>代码示例>>Java>>正文


Java ReflectionUtils.invokeJdbcMethod方法代码示例

本文整理汇总了Java中org.springframework.util.ReflectionUtils.invokeJdbcMethod方法的典型用法代码示例。如果您正苦于以下问题:Java ReflectionUtils.invokeJdbcMethod方法的具体用法?Java ReflectionUtils.invokeJdbcMethod怎么用?Java ReflectionUtils.invokeJdbcMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.util.ReflectionUtils的用法示例。


在下文中一共展示了ReflectionUtils.invokeJdbcMethod方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createConnectionSpec

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
/**
 * Create a WebSphere {@code JDBCConnectionSpec} object for the given charateristics.
 * <p>The default implementation uses reflection to apply the given settings.
 * Can be overridden in subclasses to customize the JDBCConnectionSpec object
 * (<a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/topic/com.ibm.websphere.javadoc.doc/public_html/api/com/ibm/websphere/rsadapter/JDBCConnectionSpec.html">JDBCConnectionSpec javadoc</a>;
 * <a href="http://www.ibm.com/developerworks/websphere/library/techarticles/0404_tang/0404_tang.html">IBM developerWorks article</a>).
 * @param isolationLevel the isolation level to apply (or {@code null} if none)
 * @param readOnlyFlag the read-only flag to apply (or {@code null} if none)
 * @param username the username to apply ({@code null} or empty indicates the default)
 * @param password the password to apply (may be {@code null} or empty)
 * @throws SQLException if thrown by JDBCConnectionSpec API methods
 * @see com.ibm.websphere.rsadapter.JDBCConnectionSpec
 */
protected Object createConnectionSpec(
		Integer isolationLevel, Boolean readOnlyFlag, String username, String password) throws SQLException {

	Object connSpec = ReflectionUtils.invokeJdbcMethod(this.newJdbcConnSpecMethod, null);
	if (isolationLevel != null) {
		ReflectionUtils.invokeJdbcMethod(this.setTransactionIsolationMethod, connSpec, isolationLevel);
	}
	if (readOnlyFlag != null) {
		ReflectionUtils.invokeJdbcMethod(this.setReadOnlyMethod, connSpec, readOnlyFlag);
	}
	// If the username is empty, we'll simply let the target DataSource
	// use its default credentials.
	if (StringUtils.hasLength(username)) {
		ReflectionUtils.invokeJdbcMethod(this.setUserNameMethod, connSpec, username);
		ReflectionUtils.invokeJdbcMethod(this.setPasswordMethod, connSpec, password);
	}
	return connSpec;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:WebSphereDataSourceAdapter.java

示例2: doGetConnection

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
/**
 * Builds a WebSphere JDBCConnectionSpec object for the current settings
 * and calls {@code WSDataSource.getConnection(JDBCConnectionSpec)}.
 * @see #createConnectionSpec
 * @see com.ibm.websphere.rsadapter.WSDataSource#getConnection(com.ibm.websphere.rsadapter.JDBCConnectionSpec)
 */
@Override
protected Connection doGetConnection(String username, String password) throws SQLException {
	// Create JDBCConnectionSpec using current isolation level value and read-only flag.
	Object connSpec = createConnectionSpec(
			getCurrentIsolationLevel(), getCurrentReadOnlyFlag(), username, password);
	if (logger.isDebugEnabled()) {
		logger.debug("Obtaining JDBC Connection from WebSphere DataSource [" +
				getTargetDataSource() + "], using ConnectionSpec [" + connSpec + "]");
	}
	// Create Connection through invoking WSDataSource.getConnection(JDBCConnectionSpec)
	return (Connection) ReflectionUtils.invokeJdbcMethod(
			this.wsDataSourceGetConnectionMethod, getTargetDataSource(), connSpec);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:WebSphereDataSourceAdapter.java

示例3: doGetNativeConnection

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
/**
 * Retrieve the Connection via WebSphere's {@code getNativeConnection} method.
 */
@Override
protected Connection doGetNativeConnection(Connection con) throws SQLException {
	if (this.webSphereConnectionClass.isAssignableFrom(con.getClass())) {
		return (Connection) ReflectionUtils.invokeJdbcMethod(this.webSphereNativeConnectionMethod, null, con);
	}
	return con;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:WebSphereNativeJdbcExtractor.java

示例4: doGetNativeConnection

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
/**
 * Retrieve the Connection via WebLogic's {@code getVendorConnection} method.
 */
@Override
protected Connection doGetNativeConnection(Connection con) throws SQLException {
	if (this.jdbcExtensionClass.isAssignableFrom(con.getClass())) {
		return (Connection) ReflectionUtils.invokeJdbcMethod(this.getVendorConnectionMethod, con);
	}
	return con;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:WebLogicNativeJdbcExtractor.java

示例5: doGetNativeConnection

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
/**
 * Retrieve the Connection via JBoss' {@code getUnderlyingConnection} method.
 */
@Override
protected Connection doGetNativeConnection(Connection con) throws SQLException {
	if (this.wrappedConnectionClass.isAssignableFrom(con.getClass())) {
		return (Connection) ReflectionUtils.invokeJdbcMethod(this.getUnderlyingConnectionMethod, con);
	}
	return con;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:JBossNativeJdbcExtractor.java

示例6: getNativeStatement

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
/**
 * Retrieve the Connection via JBoss' {@code getUnderlyingStatement} method.
 */
@Override
public Statement getNativeStatement(Statement stmt) throws SQLException {
	if (this.wrappedStatementClass.isAssignableFrom(stmt.getClass())) {
		return (Statement) ReflectionUtils.invokeJdbcMethod(this.getUnderlyingStatementMethod, stmt);
	}
	return stmt;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:JBossNativeJdbcExtractor.java

示例7: getNativeResultSet

import org.springframework.util.ReflectionUtils; //导入方法依赖的package包/类
/**
 * Retrieve the Connection via JBoss' {@code getUnderlyingResultSet} method.
 */
@Override
public ResultSet getNativeResultSet(ResultSet rs) throws SQLException {
	if (this.wrappedResultSetClass.isAssignableFrom(rs.getClass())) {
		return (ResultSet) ReflectionUtils.invokeJdbcMethod(this.getUnderlyingResultSetMethod, rs);
	}
	return rs;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:JBossNativeJdbcExtractor.java


注:本文中的org.springframework.util.ReflectionUtils.invokeJdbcMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。