org.springframework.jdbc.support.incrementer
Class H2SequenceMaxValueIncrementer

java.lang.Object
  extended by org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer
      extended by org.springframework.jdbc.support.incrementer.AbstractSequenceMaxValueIncrementer
          extended by org.springframework.jdbc.support.incrementer.H2SequenceMaxValueIncrementer
All Implemented Interfaces:
InitializingBean, DataFieldMaxValueIncrementer

public class H2SequenceMaxValueIncrementer
extends AbstractSequenceMaxValueIncrementer

DataFieldMaxValueIncrementer that retrieves the next value of a given H2 Database sequence.

Since:
2.5
Author:
Thomas Risberg

Field Summary
 
Fields inherited from class org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer
paddingLength
 
Constructor Summary
H2SequenceMaxValueIncrementer()
          Default constructor for bean property style usage.
H2SequenceMaxValueIncrementer(DataSource dataSource, String incrementerName)
          Convenience constructor.
 
Method Summary
protected  String getSequenceQuery()
          Return the database-specific query to use for retrieving a sequence value.
 
Methods inherited from class org.springframework.jdbc.support.incrementer.AbstractSequenceMaxValueIncrementer
getNextKey
 
Methods inherited from class org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer
afterPropertiesSet, getDataSource, getIncrementerName, getPaddingLength, nextIntValue, nextLongValue, nextStringValue, setDataSource, setIncrementerName, setPaddingLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

H2SequenceMaxValueIncrementer

public H2SequenceMaxValueIncrementer()
Default constructor for bean property style usage.

See Also:
AbstractDataFieldMaxValueIncrementer.setDataSource(javax.sql.DataSource), AbstractDataFieldMaxValueIncrementer.setIncrementerName(java.lang.String)

H2SequenceMaxValueIncrementer

public H2SequenceMaxValueIncrementer(DataSource dataSource,
                                     String incrementerName)
Convenience constructor.

Parameters:
dataSource - the DataSource to use
incrementerName - the name of the sequence/table to use
Method Detail

getSequenceQuery

protected String getSequenceQuery()
Description copied from class: AbstractSequenceMaxValueIncrementer
Return the database-specific query to use for retrieving a sequence value.

The provided SQL is supposed to result in a single row with a single column that allows for extracting a long value.

Specified by:
getSequenceQuery in class AbstractSequenceMaxValueIncrementer