Top Description Fields Constructors Methods
org.springframework.jdbc.support.incrementer

public abstract Class AbstractIdentityColumnMaxValueIncrementer

extends AbstractColumnMaxValueIncrementer
Class Inheritance
Known Direct Subclasses
org.springframework.jdbc.support.incrementer.DerbyMaxValueIncrementer, org.springframework.jdbc.support.incrementer.HsqlMaxValueIncrementer, org.springframework.jdbc.support.incrementer.MySQLIdentityColumnMaxValueIncrementer, org.springframework.jdbc.support.incrementer.SqlServerMaxValueIncrementer, org.springframework.jdbc.support.incrementer.SybaseMaxValueIncrementer
Imports
java.sql.Connection, .ResultSet, .SQLException, .Statement, javax.sql.DataSource, org.springframework.dao.DataAccessException, .DataAccessResourceFailureException, org.springframework.jdbc.datasource.DataSourceUtils, org.springframework.jdbc.support.JdbcUtils

Abstract base class for DataFieldMaxValueIncrementer implementations which are based on identity columns in a sequence-like table.
Authors
Juergen Hoeller, Thomas Risberg
Since
4.1.2

Field Summary

Modifier and TypeField and Description
private boolean
private int
nextValueIndex

The next id to serve from the value cache.

private long[]
valueCache

The current cache of values.

Constructor Summary

AccessConstructor and Description
public
AbstractIdentityColumnMaxValueIncrementer()

Default constructor for bean property style usage.

public
AbstractIdentityColumnMaxValueIncrementer(DataSource dataSource, String incrementerName, String columnName)

Method Summary

Modifier and TypeMethod and Description
protected String

Returns:

the SQL statement to use
getDeleteStatement
(long[]
the currently generated key values (the number of values corresponds to getCacheSize())
values
)

Statement to use to clean up "sequence" values.

protected abstract String

Returns:

the SQL statement to use
getIdentityStatement
()

Statement to use to obtain the current identity value.

protected abstract String

Returns:

the SQL statement to use
getIncrementStatement
()

Statement to use to increment the "sequence" value.

protected synchronized long
public boolean
isDeleteSpecificValues()

Return whether to delete the entire range below the current maximum key value (false - the default), or the specifically generated values (true).

public void
setDeleteSpecificValues(boolean deleteSpecificValues)

Specify whether to delete the entire range below the current maximum key value (false - the default), or the specifically generated values (true).

Inherited from org.springframework.jdbc.support.incrementer.AbstractColumnMaxValueIncrementer:
afterPropertiesSetgetCacheSizegetColumnNamesetCacheSizesetColumnName

Field Detail

deleteSpecificValuesback to summary
private boolean deleteSpecificValues
nextValueIndexback to summary
private int nextValueIndex

The next id to serve from the value cache.

valueCacheback to summary
private long[] valueCache

The current cache of values.

Constructor Detail

AbstractIdentityColumnMaxValueIncrementerback to summary
public AbstractIdentityColumnMaxValueIncrementer()

Default constructor for bean property style usage.

See Also
setDataSource, setIncrementerName, setColumnName
AbstractIdentityColumnMaxValueIncrementerback to summary
public AbstractIdentityColumnMaxValueIncrementer(DataSource dataSource, String incrementerName, String columnName)

Method Detail

getDeleteStatementback to summary
protected String getDeleteStatement(long[] values)

Statement to use to clean up "sequence" values.

The default implementation either deletes the entire range below the current maximum value, or the specifically generated values (starting with the lowest minus 1, just preserving the maximum value) - according to the isDeleteSpecificValues() setting.

Parameters
values:long[]

the currently generated key values (the number of values corresponds to getCacheSize())

Returns:String

the SQL statement to use

getIdentityStatementback to summary
protected abstract String getIdentityStatement()

Statement to use to obtain the current identity value.

Returns:String

the SQL statement to use

getIncrementStatementback to summary
protected abstract String getIncrementStatement()

Statement to use to increment the "sequence" value.

Returns:String

the SQL statement to use

getNextKeyback to summary
protected synchronized long getNextKey() throws DataAccessException

Implements abstract org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer.getNextKey.

Doc from org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer.getNextKey.

Determine the next key to use, as a long.

Returns:long

the key to use as a long. It will eventually be converted later in another format by the public concrete methods of this class.

Annotations
@Override
isDeleteSpecificValuesback to summary
public boolean isDeleteSpecificValues()

Return whether to delete the entire range below the current maximum key value (false - the default), or the specifically generated values (true).

setDeleteSpecificValuesback to summary
public void setDeleteSpecificValues(boolean deleteSpecificValues)

Specify whether to delete the entire range below the current maximum key value (false - the default), or the specifically generated values (true). The former mode will use a where range clause whereas the latter will use an in clause starting with the lowest value minus 1, just preserving the maximum value.