本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}