org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor Java Examples

The following examples show how to use org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CallableStatementCreatorFactory.java    From effectivejava with Apache License 2.0 4 votes vote down vote up
/**
 * Specify the NativeJdbcExtractor to use for unwrapping CallableStatements, if any.
 */
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.nativeJdbcExtractor = nativeJdbcExtractor;
}
 
Example #2
Source File: GenericTableMetaDataProvider.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.nativeJdbcExtractor = nativeJdbcExtractor;
}
 
Example #3
Source File: BatchJdbcTemplate.java    From buffer-slayer with Apache License 2.0 4 votes vote down vote up
public void setNativeJdbcExtractor(NativeJdbcExtractor extractor) {
  delegate.setNativeJdbcExtractor(extractor);
}
 
Example #4
Source File: TableMetaDataContext.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Set {@link NativeJdbcExtractor} to be used to retrieve the native connection.
 */
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.nativeJdbcExtractor = nativeJdbcExtractor;
}
 
Example #5
Source File: TableMetaDataProviderFactory.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Create a TableMetaDataProvider based on the database metedata
 * @param dataSource used to retrieve metedata
 * @param context the class that holds configuration and metedata
 * @param nativeJdbcExtractor the NativeJdbcExtractor to be used
 * @return instance of the TableMetaDataProvider implementation to be used
 */
public static TableMetaDataProvider createMetaDataProvider(DataSource dataSource,
			final TableMetaDataContext context, final NativeJdbcExtractor nativeJdbcExtractor) {
	try {
		return (TableMetaDataProvider) JdbcUtils.extractDatabaseMetaData(dataSource,
				new DatabaseMetaDataCallback() {
					@Override
					public Object processMetaData(DatabaseMetaData databaseMetaData) throws SQLException {
						String databaseProductName =
								JdbcUtils.commonDatabaseName(databaseMetaData.getDatabaseProductName());
						boolean accessTableColumnMetaData = context.isAccessTableColumnMetaData();
						TableMetaDataProvider provider;
						if ("Oracle".equals(databaseProductName)) {
							provider = new OracleTableMetaDataProvider(databaseMetaData,
									context.isOverrideIncludeSynonymsDefault());
						}
						else if ("HSQL Database Engine".equals(databaseProductName)) {
							provider = new HsqlTableMetaDataProvider(databaseMetaData);
						}
						else if ("PostgreSQL".equals(databaseProductName)) {
							provider = new PostgresTableMetaDataProvider(databaseMetaData);
						}
						else if ("Apache Derby".equals(databaseProductName)) {
							provider = new DerbyTableMetaDataProvider(databaseMetaData);
						}
						else {
							provider = new GenericTableMetaDataProvider(databaseMetaData);
						}
						if (nativeJdbcExtractor != null) {
							provider.setNativeJdbcExtractor(nativeJdbcExtractor);
						}
						if (logger.isDebugEnabled()) {
							logger.debug("Using " + provider.getClass().getSimpleName());
						}
						provider.initializeWithMetaData(databaseMetaData);
						if (accessTableColumnMetaData) {
							provider.initializeWithTableColumnMetaData(databaseMetaData, context.getCatalogName(),
									context.getSchemaName(), context.getTableName());
						}
						return provider;
					}
				});
	}
	catch (MetaDataAccessException ex) {
		throw new DataAccessResourceFailureException("Error retrieving database metadata", ex);
	}
}
 
Example #6
Source File: PreparedStatementCreatorFactory.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Specify the NativeJdbcExtractor to use for unwrapping PreparedStatements, if any.
 */
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.nativeJdbcExtractor = nativeJdbcExtractor;
}
 
Example #7
Source File: AbstractJdbcInsert.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Set the {@link NativeJdbcExtractor} to use to retrieve the native connection if necessary
 */
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.tableMetaDataContext.setNativeJdbcExtractor(nativeJdbcExtractor);
}
 
Example #8
Source File: SimpleJdbcInsert.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public SimpleJdbcInsertOperations useNativeJdbcExtractorForMetaData(NativeJdbcExtractor nativeJdbcExtractor) {
	setNativeJdbcExtractor(nativeJdbcExtractor);
	return this;
}
 
Example #9
Source File: KratosJdbcTemplate.java    From kratos-1 with Apache License 2.0 4 votes vote down vote up
@Override
public void setNativeJdbcExtractor(NativeJdbcExtractor extractor) {
	super.setNativeJdbcExtractor(extractor);
}
 
Example #10
Source File: KratosJdbcTemplate.java    From kratos-1 with Apache License 2.0 4 votes vote down vote up
@Override
public NativeJdbcExtractor getNativeJdbcExtractor() {
	return super.getNativeJdbcExtractor();
}
 
Example #11
Source File: GenericTableMetaDataProvider.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
protected NativeJdbcExtractor getNativeJdbcExtractor() {
	return this.nativeJdbcExtractor;
}
 
Example #12
Source File: JdbcTemplate.java    From effectivejava with Apache License 2.0 4 votes vote down vote up
/**
 * Return the current NativeJdbcExtractor implementation.
 */
public NativeJdbcExtractor getNativeJdbcExtractor() {
	return this.nativeJdbcExtractor;
}
 
Example #13
Source File: GenericTableMetaDataProvider.java    From effectivejava with Apache License 2.0 4 votes vote down vote up
@Override
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.nativeJdbcExtractor = nativeJdbcExtractor;
}
 
Example #14
Source File: GenericTableMetaDataProvider.java    From effectivejava with Apache License 2.0 4 votes vote down vote up
protected NativeJdbcExtractor getNativeJdbcExtractor() {
	return this.nativeJdbcExtractor;
}
 
Example #15
Source File: TableMetaDataContext.java    From effectivejava with Apache License 2.0 4 votes vote down vote up
/**
 * Set {@link NativeJdbcExtractor} to be used to retrieve the native connection.
 */
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.nativeJdbcExtractor = nativeJdbcExtractor;
}
 
Example #16
Source File: TableMetaDataProviderFactory.java    From effectivejava with Apache License 2.0 4 votes vote down vote up
/**
 * Create a TableMetaDataProvider based on the database metedata
 * @param dataSource used to retrieve metedata
 * @param context the class that holds configuration and metedata
 * @param nativeJdbcExtractor the NativeJdbcExtractor to be used
 * @return instance of the TableMetaDataProvider implementation to be used
 */
public static TableMetaDataProvider createMetaDataProvider(DataSource dataSource,
			final TableMetaDataContext context, final NativeJdbcExtractor nativeJdbcExtractor) {
	try {
		return (TableMetaDataProvider) JdbcUtils.extractDatabaseMetaData(dataSource,
				new DatabaseMetaDataCallback() {
					@Override
					public Object processMetaData(DatabaseMetaData databaseMetaData) throws SQLException {
						String databaseProductName =
								JdbcUtils.commonDatabaseName(databaseMetaData.getDatabaseProductName());
						boolean accessTableColumnMetaData = context.isAccessTableColumnMetaData();
						TableMetaDataProvider provider;
						if ("Oracle".equals(databaseProductName)) {
							provider = new OracleTableMetaDataProvider(databaseMetaData,
									context.isOverrideIncludeSynonymsDefault());
						}
						else if ("HSQL Database Engine".equals(databaseProductName)) {
							provider = new HsqlTableMetaDataProvider(databaseMetaData);
						}
						else if ("PostgreSQL".equals(databaseProductName)) {
							provider = new PostgresTableMetaDataProvider(databaseMetaData);
						}
						else if ("Apache Derby".equals(databaseProductName)) {
							provider = new DerbyTableMetaDataProvider(databaseMetaData);
						}
						else {
							provider = new GenericTableMetaDataProvider(databaseMetaData);
						}
						if (nativeJdbcExtractor != null) {
							provider.setNativeJdbcExtractor(nativeJdbcExtractor);
						}
						if (logger.isDebugEnabled()) {
							logger.debug("Using " + provider.getClass().getSimpleName());
						}
						provider.initializeWithMetaData(databaseMetaData);
						if (accessTableColumnMetaData) {
							provider.initializeWithTableColumnMetaData(databaseMetaData, context.getCatalogName(),
									context.getSchemaName(), context.getTableName());
						}
						return provider;
					}
				});
	}
	catch (MetaDataAccessException ex) {
		throw new DataAccessResourceFailureException("Error retrieving database metadata", ex);
	}
}
 
Example #17
Source File: PreparedStatementCreatorFactory.java    From effectivejava with Apache License 2.0 4 votes vote down vote up
/**
 * Specify the NativeJdbcExtractor to use for unwrapping PreparedStatements, if any.
 */
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.nativeJdbcExtractor = nativeJdbcExtractor;
}
 
Example #18
Source File: AbstractJdbcInsert.java    From effectivejava with Apache License 2.0 4 votes vote down vote up
/**
 * Set the {@link NativeJdbcExtractor} to use to retrieve the native connection if necessary
 */
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.tableMetaDataContext.setNativeJdbcExtractor(nativeJdbcExtractor);
}
 
Example #19
Source File: SimpleJdbcInsert.java    From effectivejava with Apache License 2.0 4 votes vote down vote up
@Override
public SimpleJdbcInsertOperations useNativeJdbcExtractorForMetaData(NativeJdbcExtractor nativeJdbcExtractor) {
	setNativeJdbcExtractor(nativeJdbcExtractor);
	return this;
}
 
Example #20
Source File: TableMetaDataContext.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Set {@link NativeJdbcExtractor} to be used to retrieve the native connection.
 */
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.nativeJdbcExtractor = nativeJdbcExtractor;
}
 
Example #21
Source File: BatchJdbcTemplate.java    From buffer-slayer with Apache License 2.0 4 votes vote down vote up
public NativeJdbcExtractor getNativeJdbcExtractor() {
  return delegate.getNativeJdbcExtractor();
}
 
Example #22
Source File: CallableStatementCreatorFactory.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Specify the NativeJdbcExtractor to use for unwrapping CallableStatements, if any.
 */
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.nativeJdbcExtractor = nativeJdbcExtractor;
}
 
Example #23
Source File: JdbcTemplate.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Return the current NativeJdbcExtractor implementation.
 */
public NativeJdbcExtractor getNativeJdbcExtractor() {
	return this.nativeJdbcExtractor;
}
 
Example #24
Source File: GenericTableMetaDataProvider.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.nativeJdbcExtractor = nativeJdbcExtractor;
}
 
Example #25
Source File: GenericTableMetaDataProvider.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
protected NativeJdbcExtractor getNativeJdbcExtractor() {
	return this.nativeJdbcExtractor;
}
 
Example #26
Source File: TableMetaDataProviderFactory.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a TableMetaDataProvider based on the database metadata.
 * @param dataSource used to retrieve metadata
 * @param context the class that holds configuration and metadata
 * @param nativeJdbcExtractor the NativeJdbcExtractor to be used
 * @return instance of the TableMetaDataProvider implementation to be used
 */
public static TableMetaDataProvider createMetaDataProvider(DataSource dataSource,
			final TableMetaDataContext context, final NativeJdbcExtractor nativeJdbcExtractor) {
	try {
		return (TableMetaDataProvider) JdbcUtils.extractDatabaseMetaData(dataSource,
				new DatabaseMetaDataCallback() {
					@Override
					public Object processMetaData(DatabaseMetaData databaseMetaData) throws SQLException {
						String databaseProductName =
								JdbcUtils.commonDatabaseName(databaseMetaData.getDatabaseProductName());
						boolean accessTableColumnMetaData = context.isAccessTableColumnMetaData();
						TableMetaDataProvider provider;
						if ("Oracle".equals(databaseProductName)) {
							provider = new OracleTableMetaDataProvider(databaseMetaData,
									context.isOverrideIncludeSynonymsDefault());
						}
						else if ("HSQL Database Engine".equals(databaseProductName)) {
							provider = new HsqlTableMetaDataProvider(databaseMetaData);
						}
						else if ("PostgreSQL".equals(databaseProductName)) {
							provider = new PostgresTableMetaDataProvider(databaseMetaData);
						}
						else if ("Apache Derby".equals(databaseProductName)) {
							provider = new DerbyTableMetaDataProvider(databaseMetaData);
						}
						else {
							provider = new GenericTableMetaDataProvider(databaseMetaData);
						}
						if (nativeJdbcExtractor != null) {
							provider.setNativeJdbcExtractor(nativeJdbcExtractor);
						}
						if (logger.isDebugEnabled()) {
							logger.debug("Using " + provider.getClass().getSimpleName());
						}
						provider.initializeWithMetaData(databaseMetaData);
						if (accessTableColumnMetaData) {
							provider.initializeWithTableColumnMetaData(databaseMetaData, context.getCatalogName(),
									context.getSchemaName(), context.getTableName());
						}
						return provider;
					}
				});
	}
	catch (MetaDataAccessException ex) {
		throw new DataAccessResourceFailureException("Error retrieving database metadata", ex);
	}
}
 
Example #27
Source File: PreparedStatementCreatorFactory.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Specify the NativeJdbcExtractor to use for unwrapping PreparedStatements, if any.
 */
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.nativeJdbcExtractor = nativeJdbcExtractor;
}
 
Example #28
Source File: AbstractJdbcInsert.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Set the {@link NativeJdbcExtractor} to use to retrieve the native connection if necessary
 */
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.tableMetaDataContext.setNativeJdbcExtractor(nativeJdbcExtractor);
}
 
Example #29
Source File: SimpleJdbcInsert.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public SimpleJdbcInsertOperations useNativeJdbcExtractorForMetaData(NativeJdbcExtractor nativeJdbcExtractor) {
	setNativeJdbcExtractor(nativeJdbcExtractor);
	return this;
}
 
Example #30
Source File: CallableStatementCreatorFactory.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Specify the NativeJdbcExtractor to use for unwrapping CallableStatements, if any.
 */
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) {
	this.nativeJdbcExtractor = nativeJdbcExtractor;
}