|
Berkeley DB version 4.3.29 |
||||||||||
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
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.setAllowPopulate(true);
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. |
SecondaryKeyCreator |
getKeyCreator()
Returns the user-supplied object used for creating secondary keys. |
void |
setAllowPopulate(boolean allowPopulate)
Specifies whether automatic population of the secondary is allowed. |
void |
setKeyCreator(SecondaryKeyCreator keyCreator)
Specifies the user-supplied object used for creating secondary keys. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final SecondaryConfig DEFAULT
Constructor Detail |
public SecondaryConfig()
Method Detail |
public void setKeyCreator(SecondaryKeyCreator keyCreator)
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 secondary
keys.public SecondaryKeyCreator getKeyCreator()
setKeyCreator(com.sleepycat.db.SecondaryKeyCreator)
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 environment is transactional, the secondary database must be opened within a transaction.
allowPopulate
- whether automatic population of the secondary is
allowed.public boolean getAllowPopulate()
setAllowPopulate(boolean)
has not been called, this method returns
false.
setAllowPopulate(boolean)
|
Berkeley DB version 4.3.29 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |