Class PostgresSequenceMaxValueIncrementer
- java.lang.Object
- org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer
- org.springframework.jdbc.support.incrementer.AbstractSequenceMaxValueIncrementer
- org.springframework.jdbc.support.incrementer.PostgresSequenceMaxValueIncrementer
- All Implemented Interfaces:
InitializingBean
,DataFieldMaxValueIncrementer
- Direct Known Subclasses:
PostgreSQLSequenceMaxValueIncrementer
public class PostgresSequenceMaxValueIncrementer extends AbstractSequenceMaxValueIncrementer
DataFieldMaxValueIncrementer
that retrieves the next value of a given PostgreSQL sequence.Thanks to Tomislav Urban for the suggestion!
- Since:
- 4.3.15
- Author:
- Juergen Hoeller
Field Summary
Fields inherited from class org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer
paddingLength
Constructor Summary
Constructors Constructor Description PostgresSequenceMaxValueIncrementer()
Default constructor for bean property style usage.PostgresSequenceMaxValueIncrementer(DataSource dataSource, String incrementerName)
Convenience constructor.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
Constructor Detail
PostgresSequenceMaxValueIncrementer
public PostgresSequenceMaxValueIncrementer()
Default constructor for bean property style usage.
PostgresSequenceMaxValueIncrementer
public PostgresSequenceMaxValueIncrementer(DataSource dataSource, String incrementerName)
Convenience constructor.- Parameters:
dataSource
- the DataSource to useincrementerName
- 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 classAbstractSequenceMaxValueIncrementer