public class MySQLMultipleTableMaxValueIncrementer
extends org.springframework.jdbc.support.incrementer.AbstractColumnMaxValueIncrementer
create table tab (id int unsigned not null primary key, text varchar(100));
create table tab_sequence (tab varchar(255) not null, value int not null);
insert into tab_sequence values("tab", 0);| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_COLUMN_NAME_OF_TABLE |
static String |
DEFAULT_INCREMENTER_NAME |
| Constructor and Description |
|---|
MySQLMultipleTableMaxValueIncrementer(DataSource dataSource,
String incrementerName,
String columnNameOfTable,
String columnValueOfTable,
String columnName) |
| Modifier and Type | Method and Description |
|---|---|
protected long |
getNextKey() |
void |
setUseNewConnection(boolean useNewConnection) |
afterPropertiesSet, getCacheSize, getColumnName, setCacheSize, setColumnNamepublic static final String DEFAULT_INCREMENTER_NAME
public static final String DEFAULT_COLUMN_NAME_OF_TABLE
public MySQLMultipleTableMaxValueIncrementer(DataSource dataSource, String incrementerName, String columnNameOfTable, String columnValueOfTable, String columnName)
dataSource - the DataSource to useincrementerName - the name of the sequence table to usecolumnNameOfTable - the name of the column record table that use primary keycolumnValueOfTable - the value of table that use primary keycolumnName - the name of the column in the sequence table to usepublic void setUseNewConnection(boolean useNewConnection)
protected long getNextKey()
throws org.springframework.dao.DataAccessException
getNextKey in class org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementerorg.springframework.dao.DataAccessExceptionCopyright © 2022. All rights reserved.