public class PersistKeyCreator extends java.lang.Object implements SecondaryKeyCreator, SecondaryMultiKeyCreator, ForeignMultiKeyNullifier
Constructor and Description |
---|
PersistKeyCreator(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.
|
(package private) static boolean |
isManyType(java.lang.Class cls) |
boolean |
nullifyForeignKey(SecondaryDatabase secondary,
DatabaseEntry key,
DatabaseEntry data,
DatabaseEntry secKey)
Sets the foreign key reference to null in the datum of the primary
database.
|
(package private) void |
refresh(PersistCatalog newCatalog)
See Store.refresh.
|
public PersistKeyCreator(Catalog catalogParam, EntityMetadata entityMeta, java.lang.String keyClassName, SecondaryKeyMetadata secKeyMeta, boolean rawAccess)
static boolean isManyType(java.lang.Class cls)
public boolean createSecondaryKey(SecondaryDatabase secondary, DatabaseEntry key, DatabaseEntry data, DatabaseEntry result)
SecondaryKeyCreator
A 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.
A RuntimeException
may be thrown by this method if an error
occurs attempting to create the secondary key. This exception will be
thrown by the API method currently in progress, for example, a put
method. However, this will cause the write operation
to be incomplete. When databases are not configured to be
transactional, caution should be used to avoid integrity problems. See
Special considerations for
using Secondary Databases with and without Transactions.
createSecondaryKey
in interface SecondaryKeyCreator
secondary
- 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)
SecondaryMultiKeyCreator
A 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.
A RuntimeException
may be thrown by this method if an error
occurs attempting to create the secondary key. This exception will be
thrown by the API method currently in progress, for example, a put
method. However, this will cause the write operation
to be incomplete. When databases are not configured to be
transactional, caution should be used to avoid integrity problems. See
Special considerations for
using Secondary Databases with and without Transactions.
createSecondaryKeys
in interface SecondaryMultiKeyCreator
secondary
- 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)
ForeignMultiKeyNullifier
nullifyForeignKey
in interface ForeignMultiKeyNullifier
secondary
- 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.void refresh(PersistCatalog newCatalog)
Copyright (c) 2004-2012 Oracle. All rights reserved.