Use this interface when any number of secondary keys may be present in a single primary record, in other words, for many-to-many and one-to-many relationships. When only zero or one secondary key is present (for many-to-one and one-to-one relationships) you may use the {@link SecondaryKeyCreator} interface instead.The table below summarizes how to create all four variations of relationships.
Relationship | Interface | Duplicates | Example |
---|---|---|---|
One-to-one | {@link SecondaryKeyCreator} | No | A person record with a unique social security number key. |
Many-to-one | {@link SecondaryKeyCreator} | Yes | A person record with a non-unique employer key. |
One-to-many | {@link SecondaryMultiKeyCreator} | No | A person record with multiple unique email address keys. |
Many-to-many | {@link SecondaryMultiKeyCreator} | Yes | A person record with multiple non-unique organization keys. |
To configure a database for duplicates. pass true to {@link DatabaseConfig#setSortedDuplicates}.
Note that SecondaryMultiKeyCreator
may also be used for single key secondaries (many-to-one and one-to-one); in this case, at most a single key is added to the results set. SecondaryMultiKeyCreator
is only slightly less efficient than {@link SecondaryKeyCreator} in that two or threetemporary sets must be created to hold the results.
@see SecondaryConfig
|
|