public abstract class AbstractJDBCIDMigrator extends AbstractIDMigrator implements UpdatableIDMigrator
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_LONG_ID_COLUMN |
static String |
DEFAULT_MAPPING_TABLE |
static String |
DEFAULT_STRING_ID_COLUMN |
Modifier | Constructor and Description |
---|---|
protected |
AbstractJDBCIDMigrator(DataSource dataSource,
String getStringIDSQL,
String storeMappingSQL) |
Modifier and Type | Method and Description |
---|---|
void |
initialize(Iterable<String> stringIDs)
Make the mapping aware of the given string IDs.
|
void |
storeMapping(long longID,
String stringID)
Stores the reverse long-to-String mapping in some kind of backing store.
|
String |
toStringID(long longID) |
hash, refresh, toLongID
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toLongID
refresh
public static final String DEFAULT_MAPPING_TABLE
public static final String DEFAULT_LONG_ID_COLUMN
public static final String DEFAULT_STRING_ID_COLUMN
protected AbstractJDBCIDMigrator(DataSource dataSource, String getStringIDSQL, String storeMappingSQL)
getStringIDSQL
- SQL statement which selects one column, the String ID, from a mapping table. The statement
should take one long parameter.storeMappingSQL
- SQL statement which saves a mapping from long to String. It should take two parameters, a long
and a String.public final void storeMapping(long longID, String stringID) throws TasteException
UpdatableIDMigrator
UpdatableIDMigrator.initialize(Iterable)
) for every String that might be encountered
in the application, or else the mapping will not be known.storeMapping
in interface UpdatableIDMigrator
longID
- long IDstringID
- string ID that maps to/from that long IDTasteException
- if an error occurs while saving the mappingpublic final String toStringID(long longID) throws TasteException
toStringID
in interface IDMigrator
TasteException
- if an error occurs while retrieving the mappingpublic void initialize(Iterable<String> stringIDs) throws TasteException
UpdatableIDMigrator
initialize
in interface UpdatableIDMigrator
TasteException
- if an error occurs while storing the mappingsCopyright © 2008–2017 The Apache Software Foundation. All rights reserved.