public class PersistKeyCreator extends java.lang.Object implements SecondaryKeyCreator, SecondaryMultiKeyCreator, ForeignMultiKeyNullifier
| Constructor and Description |
|---|
PersistKeyCreator(com.sleepycat.persist.impl.Catalog catalogParam,
EntityMetadata entityMeta,
java.lang.String keyClassName,
SecondaryKeyMetadata secKeyMeta,
boolean rawAccess)
Creates a key creator/nullifier for a given entity class and key name.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
createSecondaryKey(SecondaryDatabase secondary,
DatabaseEntry key,
DatabaseEntry data,
DatabaseEntry result)
Creates a secondary key entry, given a primary key and data entry.
|
void |
createSecondaryKeys(SecondaryDatabase secondary,
DatabaseEntry key,
DatabaseEntry data,
java.util.Set results)
Creates a secondary key entry, given a primary key and data entry.
|
boolean |
nullifyForeignKey(SecondaryDatabase secondary,
DatabaseEntry key,
DatabaseEntry data,
DatabaseEntry secKey)
Sets the foreign key reference to null in the datum of the primary
database.
|
public PersistKeyCreator(com.sleepycat.persist.impl.Catalog catalogParam,
EntityMetadata entityMeta,
java.lang.String keyClassName,
SecondaryKeyMetadata secKeyMeta,
boolean rawAccess)
public boolean createSecondaryKey(SecondaryDatabase secondary, DatabaseEntry key, DatabaseEntry data, DatabaseEntry result)
SecondaryKeyCreatorA secondary key may be derived from the primary key, primary data, or a combination of the primary key and data. For secondary keys that are optional, the key creator method may return false and the key/data pair will not be indexed. To ensure the integrity of a secondary database the key creator method must always return the same result for a given set of input parameters.
createSecondaryKey in interface SecondaryKeyCreatorsecondary - the database to which the secondary key will be added.
This parameter is passed for informational purposes but is not commonly
used.
key - the primary key entry. This parameter must not be modified
by this method.
data - the primary data entry. This parameter must not be modified
by this method.
result - the secondary key created by this method.
public void createSecondaryKeys(SecondaryDatabase secondary, DatabaseEntry key, DatabaseEntry data, java.util.Set results)
SecondaryMultiKeyCreatorA secondary key may be derived from the primary key, primary data, or a combination of the primary key and data. Zero or more secondary keys may be derived from the primary record and returned in the results parameter. To ensure the integrity of a secondary database the key creator method must always return the same results for a given set of input parameters.
createSecondaryKeys in interface SecondaryMultiKeyCreatorsecondary - the database to which the secondary key will be added.
This parameter is passed for informational purposes but is not commonly
used.
key - the primary key entry. This parameter must not be modified
by this method.
data - the primary data entry. This parameter must not be modified
by this method.
results - the set to contain the the secondary key DatabaseEntry
objects created by this method.
public boolean nullifyForeignKey(SecondaryDatabase secondary, DatabaseEntry key, DatabaseEntry data, DatabaseEntry secKey)
ForeignMultiKeyNullifiernullifyForeignKey in interface ForeignMultiKeyNullifiersecondary - the database in which the foreign key integrity
constraint is defined. This parameter is passed for informational
purposes but is not commonly used.key - the existing primary key. This parameter is passed for
informational purposes but is not commonly used.data - the existing primary datum in which the foreign key
reference should be set to null. This parameter should be updated by
this method if it returns true.secKey - the secondary key to be nullified. This parameter is
needed for knowing which key to nullify when multiple keys are present,
as when SecondaryMultiKeyCreator is used.