com.univocity.api.entity.jdbc
Class JdbcQueryConfiguration

java.lang.Object
  extended by com.univocity.api.entity.Configuration
      extended by com.univocity.api.entity.jdbc.JdbcQueryConfiguration

public final class JdbcQueryConfiguration
extends Configuration

This class provides configuration options for query-based JDBC data entities. Instances are accessible through a JdbcDataStoreConfiguration configuration object.

Queries are read-only and mapping data to one will cause an IllegalConfigurationException.

Parameters must be prefixed with a colon, for example:

SELECT col_1, col2 FROM table WHERE col_1 = :param_1 OR col_2 = :param_2

Author:
uniVocity Software Pty Ltd - dev@univocity.com

Method Summary
 DefaultEntityField configureField(String fieldName)
          Configures the properties of a field in this entity.
protected  void copyDefaultsFrom(Configuration defaultsObject)
          Applies default values to undefined settings using a Configuration object.
 int getFetchSize()
          Obtains the number of rows to return for an open ResultSet in a each each trip to the database.
 void setFetchSize(int fetchSize)
          Defines the number of rows to return for an open ResultSet in a each each trip to the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFetchSize

public final int getFetchSize()
Obtains the number of rows to return for an open ResultSet in a each each trip to the database.

uniVocity passes this value directly to your database driver using Statement.setFetchSize(int).

For performance reasons, you might want to adjust the fetch size to reflect the common number of rows returned for this entity. A big fetch size number might consume too many resources and will be excessive for a small number of records. A small fetch size for too many rows will cause slowness (e.g. a fetch size of 100 to read 10,000 rows and will generate 100 roundtrips to the database).

Defaults to 10,000 rows

Returns:
the fetch size to use when reading values from the configured JDBC data entity.
See Also:
Statement

setFetchSize

public final void setFetchSize(int fetchSize)
Defines the number of rows to return for an open ResultSet in a each each trip to the database.

uniVocity passes this value directly to your database driver using Statement.setFetchSize(int).

For performance reasons, you might want to adjust the fetch size to reflect the common number of rows returned for this entity. A big fetch size number might consume too many resources and will be excessive for a small number of records. A small fetch size for too many rows will cause slowness (e.g. a fetch size of 100 to read 10,000 rows and will generate 100 roundtrips to the database).

Parameters:
fetchSize - the fetch size to use when reading values from the configured JDBC data entity.
This parameter is not validated as some database drivers accept special settings for the fetch size, such as Integer.MIN_VALUE.
See Also:
Statement

copyDefaultsFrom

protected void copyDefaultsFrom(Configuration defaultsObject)
Applies default values to undefined settings using a Configuration object.

Specified by:
copyDefaultsFrom in class Configuration
Parameters:
defaultsObject - a configuration object from where to obtain default settings.

configureField

public DefaultEntityField configureField(String fieldName)
Configures the properties of a field in this entity. uniVocity autodetects column metadata of JDBC entities, but it may not always obtain all the information it needs from the JDBC driver. For example, it can't detect autogenerated columns where values are produced by a trigger (e.g. Oracle, prior to version 12, did not have an IDENTITY type)

Parameters:
fieldName - the name of the field to be configured explicitly
Returns:
a DefaultEntityField object with properties that can be manually set for the given field.


Copyright © 2015 uniVocity Software Pty Ltd. All rights reserved.