|
Berkeley DB version 4.8.30 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sleepycat.db.DatabaseConfig com.sleepycat.db.SecondaryConfig
public class SecondaryConfig
The configuration properties of a SecondaryDatabase
extend
those of a primary Database
.
The secondary database configuration is specified when calling Environment.openSecondaryDatabase
.
To create a configuration object with default attributes:
SecondaryConfig config = new SecondaryConfig();To set custom attributes:
SecondaryConfig config = new SecondaryConfig(); config.setAllowCreate(true); config.setSortedDuplicates(true); config.setKeyCreator(new MyKeyCreator());
NOTE: There are two situations where the use of secondary databases without transactions requires special consideration. When using a transactional database or when doing read operations only, this note does not apply.
DatabaseException
will be thrown in this situation.ABORT
(the default setting), a DatabaseException
will be thrown if an attempt is made to delete a referenced foreign
key.
Environment.openSecondaryDatabase
,
SecondaryDatabase
Field Summary | |
---|---|
static SecondaryConfig |
DEFAULT
|
Constructor Summary | |
---|---|
SecondaryConfig()
Creates an instance with the system's default settings. |
Method Summary | |
---|---|
boolean |
getAllowPopulate()
Returns whether automatic population of the secondary is allowed. |
com.sleepycat.db.internal.Db |
getForeignKeyDatabase()
|
ForeignKeyDeleteAction |
getForeignKeyDeleteAction()
|
ForeignKeyNullifier |
getForeignKeyNullifier()
|
ForeignMultiKeyNullifier |
getForeignMultiKeyNullifier()
|
boolean |
getImmutableSecondaryKey()
Returns whether the secondary key is immutable. |
SecondaryKeyCreator |
getKeyCreator()
Returns the user-supplied object used for creating single-valued secondary keys. |
SecondaryMultiKeyCreator |
getMultiKeyCreator()
Returns the user-supplied object used for creating multi-valued secondary keys. |
void |
setAllowPopulate(boolean allowPopulate)
Specifies whether automatic population of the secondary is allowed. |
void |
setForeignKeyDatabase(Database foreignDb)
|
void |
setForeignKeyDeleteAction(ForeignKeyDeleteAction action)
|
void |
setForeignKeyNullifier(ForeignKeyNullifier keyNullifier)
|
void |
setForeignMultiKeyNullifier(ForeignMultiKeyNullifier multiKeyNullifier)
|
void |
setImmutableSecondaryKey(boolean immutableSecondaryKey)
Specifies whether the secondary key is immutable. |
void |
setKeyCreator(SecondaryKeyCreator keyCreator)
Specifies the user-supplied object used for creating single-valued secondary keys. |
void |
setMultiKeyCreator(SecondaryMultiKeyCreator multiKeyCreator)
Specifies the user-supplied object used for creating multi-valued secondary keys. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final SecondaryConfig DEFAULT
Constructor Detail |
---|
public SecondaryConfig()
Method Detail |
---|
public void setAllowPopulate(boolean allowPopulate)
If automatic population is allowed, when the secondary database is opened it is checked to see if it is empty. If it is empty, the primary database is read in its entirety and keys are added to the secondary database using the information read from the primary.
If this property is set to true and the database is transactional, the population of the secondary will be done within the explicit or auto-commit transaction that is used to open the database.
allowPopulate
- whether automatic population of the secondary is
allowed.public boolean getAllowPopulate()
setAllowPopulate(boolean)
has not been called, this method returns
false.
setAllowPopulate(boolean)
public void setImmutableSecondaryKey(boolean immutableSecondaryKey)
Specifying that a secondary key is immutable can be used to optimize
updates when the secondary key in a primary record will never be changed
after that primary record is inserted. For immutable secondary keys, a
best effort is made to avoid calling
SecondaryKeyCreator.createSecondaryKey
when a primary record
is updated. This optimization may reduce the overhead of an update
operation significantly if the createSecondaryKey
operation is
expensive.
Be sure to set this property to true only if the secondary key in the primary record is never changed. If this rule is violated, the secondary index will become corrupted, that is, it will become out of sync with the primary.
immutableSecondaryKey
- whether the secondary key is immutable.public boolean getImmutableSecondaryKey()
setImmutableSecondaryKey(boolean)
has not been called, this method returns
false.
setImmutableSecondaryKey(boolean)
public void setKeyCreator(SecondaryKeyCreator keyCreator)
Unless the primary database is read-only, a key creator is required when opening a secondary database. Either a KeyCreator or MultiKeyCreator must be specified, but both may not be specified.
Unless the primary database is read-only, a key creator is required when opening a secondary database.
keyCreator
- the user-supplied object used for creating single-valued
secondary keys.public SecondaryKeyCreator getKeyCreator()
setKeyCreator(com.sleepycat.db.SecondaryKeyCreator)
public void setMultiKeyCreator(SecondaryMultiKeyCreator multiKeyCreator)
Unless the primary database is read-only, a key creator is required when opening a secondary database. Either a KeyCreator or MultiKeyCreator must be specified, but both may not be specified.
multiKeyCreator
- the user-supplied object used for creating multi-valued
secondary keys.public SecondaryMultiKeyCreator getMultiKeyCreator()
setKeyCreator(com.sleepycat.db.SecondaryKeyCreator)
public void setForeignKeyDatabase(Database foreignDb)
public com.sleepycat.db.internal.Db getForeignKeyDatabase()
public void setForeignKeyDeleteAction(ForeignKeyDeleteAction action)
public ForeignKeyDeleteAction getForeignKeyDeleteAction()
public void setForeignKeyNullifier(ForeignKeyNullifier keyNullifier)
public ForeignKeyNullifier getForeignKeyNullifier()
public void setForeignMultiKeyNullifier(ForeignMultiKeyNullifier multiKeyNullifier)
public ForeignMultiKeyNullifier getForeignMultiKeyNullifier()
|
Berkeley DB version 4.8.30 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |