This information is used to both maintain a history of all objects modified through TopLink and to enable point in time querying.
If Oracle 9R2 or later Flashback is used this policy is not required, as the preservation of history is automatic.
Descriptors, ManyToManyMappings, DirectCollectionMappings, and DirectMapMappings only can have a history policy, as only they have associated database tables.
| Modifier and Type | Field and Description |
|---|---|
| protected ClassDescriptor | |
| protected List | |
| protected List | |
| protected DatabaseMapping | |
| protected boolean | |
| protected List | |
| protected boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | addHistoryTableName(String name)
PUBLIC: Use to specify the names of the mirroring historical tables. |
| public void | addHistoryTableName(String sourceTableName, String historyTableName)
PUBLIC: Use to specify the names of the mirroring historical tables. |
| public Expression | additionalHistoryExpression(Expression context, Expression base)
INTERNAL: Add any temporal querying conditions to this object expression. |
| public Expression | additionalHistoryExpression(Expression context, Expression base, Integer
not null indicates that only expression for a single table should be returned. tableIndex)INTERNAL: Add any temporal querying conditions to this object expression. |
| public void | |
| protected boolean | checkWastedVersioning(AbstractRecord modifyRow, DatabaseTable table)
INTERNAL: Checks for the case where an object has multiple tables but only some are part of a minimal update. |
| public Object | |
| public Object | getCurrentTime(AbstractSession session)
PUBLIC: Whenever a historical record is logically deleted (updated) or inserted, the end and start fields respectively will be set to this value. |
| public ClassDescriptor | |
| protected DatabaseField | |
| protected DatabaseField | |
| public String | |
| public List | |
| public final List | |
| public List | |
| public DatabaseMapping | |
| public long | getMinimumTimeIncrement(AbstractSession session)
INTERNAL: Return a minimal time increment supported by the platform. |
| protected DatabaseField | |
| protected DatabaseField | |
| public String | |
| public List | |
| public void | |
| public void | logicalDelete(ModifyQuery writeQuery, boolean isUpdate)
INTERNAL: Performs a logical delete (update) on the historical schema. |
| public void | logicalDelete(ModifyQuery writeQuery, boolean isUpdate, boolean isShallow)
INTERNAL: Performs a logical delete (update) on the historical schema. |
| public void | logicalInsert(ObjectLevelModifyQuery writeQuery, boolean isUpdate)
INTERNAL: Perform a logical insert into the historical schema, creating a new version of an object. |
| public void | mappingLogicalDelete(ModifyQuery originalQuery, AbstractRecord arguments, AbstractSession session)
INTERNAL: Performs a logical delete (update) on the historical schema. |
| public void | mappingLogicalInsert(DataModifyQuery originalQuery, AbstractRecord arguments, AbstractSession session)
INTERNAL: Performs a logical insert into the historical schema. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| protected void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setShouldUseDatabaseTime(boolean
if false uses localTime (default) instead value)Sets if the Timestamp used in maintainaing history should be the current time according to the database. |
| protected void | |
| public void | |
| public boolean | |
| public boolean | Returns: false by defaultAnswers if the Timestamp used in maintaining history should be the current time according to the database. |
| public boolean | Returns: true by defaultAnswers if the Timestamp used in maintaining history should be System.currentTimeMillis(); |
| public void | useDatabaseTime()
Answers if the Timestamp used in maintaining history should be the current time according to the database. |
| public void | useLocalTime()
Answers if the Timestamp used in maintaining history should be System.currentTimeMillis(); |
| protected void | verifyTableQualifiers(DatasourcePlatform platform)
INTERNAL: Check that the qualifiers on the historical tables are properly set. |
| descriptor | back to summary |
|---|---|
| protected ClassDescriptor descriptor | |
| endFields | back to summary |
|---|---|
| protected List<DatabaseField> endFields | |
| historicalTables | back to summary |
|---|---|
| protected List<DatabaseTable> historicalTables | |
| mapping | back to summary |
|---|---|
| protected DatabaseMapping mapping | |
| shouldHandleWrites | back to summary |
|---|---|
| protected boolean shouldHandleWrites | |
| startFields | back to summary |
|---|---|
| protected List<DatabaseField> startFields | |
| usesLocalTime | back to summary |
|---|---|
| protected boolean usesLocalTime | |
| HistoryPolicy | back to summary |
|---|---|
| public HistoryPolicy() | |
| addEndFieldName | back to summary |
|---|---|
| public void addEndFieldName(String endFieldName) PUBLIC:
| |
| addHistoryTableName | back to summary |
|---|---|
| public void addHistoryTableName(String name) PUBLIC: Use to specify the names of the mirroring historical tables. Assumes that the order in which tables are added with descriptor.addTableName() matches the order in which mirroring historical tables are added with descriptor.addHistoryTableName(). | |
| addHistoryTableName | back to summary |
|---|---|
| public void addHistoryTableName(String sourceTableName, String historyTableName) PUBLIC: Use to specify the names of the mirroring historical tables.
Explicitly states that | |
| additionalHistoryExpression | back to summary |
|---|---|
| public Expression additionalHistoryExpression(Expression context, Expression base) INTERNAL: Add any temporal querying conditions to this object expression. | |
| additionalHistoryExpression | back to summary |
|---|---|
| public Expression additionalHistoryExpression(Expression context, Expression base, Integer tableIndex) INTERNAL: Add any temporal querying conditions to this object expression.
| |
| addStartFieldName | back to summary |
|---|---|
| public void addStartFieldName(String startFieldName) PUBLIC: Sets the name of the start field. By default all tables belonging to a descriptor have the same primary key field names, and so the same start field names also.
However, if | |
| checkWastedVersioning | back to summary |
|---|---|
| protected boolean checkWastedVersioning(AbstractRecord modifyRow, DatabaseTable table) INTERNAL: Checks for the case where an object has multiple tables but only some are part of a minimal update. | |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. PUBLIC: Performs a sufficiently deep clone. Use to quickly setup standard policies on multiple descriptors.
| |
| getCurrentTime | back to summary |
|---|---|
| public Object getCurrentTime(AbstractSession session) PUBLIC: Whenever a historical record is logically deleted (updated) or inserted, the end and start fields respectively will be set to this value. | |
| getDescriptor | back to summary |
|---|---|
| public ClassDescriptor getDescriptor() PUBLIC: Return the descriptor of the policy. | |
| getEnd | back to summary |
|---|---|
| protected DatabaseField getEnd() INTERNAL: | |
| getEnd | back to summary |
|---|---|
| protected DatabaseField getEnd(int i) INTERNAL: | |
| getEndFieldName | back to summary |
|---|---|
| public String getEndFieldName() PUBLIC: | |
| getEndFields | back to summary |
|---|---|
| public List INTERNAL: | |
| getHistoricalTables | back to summary |
|---|---|
| public final List INTERNAL: | |
| getHistoryTableNames | back to summary |
|---|---|
| public List PUBLIC: | |
| getMapping | back to summary |
|---|---|
| public DatabaseMapping getMapping() PUBLIC: | |
| getMinimumTimeIncrement | back to summary |
|---|---|
| public long getMinimumTimeIncrement(AbstractSession session) INTERNAL: Return a minimal time increment supported by the platform. | |
| getStart | back to summary |
|---|---|
| protected DatabaseField getStart() INTERNAL: | |
| getStart | back to summary |
|---|---|
| protected DatabaseField getStart(int i) INTERNAL: | |
| getStartFieldName | back to summary |
|---|---|
| public String getStartFieldName() PUBLIC: Answers the name of the start field. Assumes that multiple tables for a descriptor have the same field names. | |
| getStartFields | back to summary |
|---|---|
| public List INTERNAL: | |
| initialize | back to summary |
|---|---|
| public void initialize(AbstractSession session) INTERNAL: Initialize a HistoryPolicy. | |
| logicalDelete | back to summary |
|---|---|
| public void logicalDelete(ModifyQuery writeQuery, boolean isUpdate) INTERNAL: Performs a logical delete (update) on the historical schema. | |
| logicalDelete | back to summary |
|---|---|
| public void logicalDelete(ModifyQuery writeQuery, boolean isUpdate, boolean isShallow) INTERNAL: Performs a logical delete (update) on the historical schema. | |
| logicalInsert | back to summary |
|---|---|
| public void logicalInsert(ObjectLevelModifyQuery writeQuery, boolean isUpdate) INTERNAL: Perform a logical insert into the historical schema, creating a new version of an object. Called by postInsert() and also postUpdate() (which first does a logicalDelete of the previous version). | |
| mappingLogicalDelete | back to summary |
|---|---|
| public void mappingLogicalDelete(ModifyQuery originalQuery, AbstractRecord arguments, AbstractSession session) INTERNAL: Performs a logical delete (update) on the historical schema. Direct collections and many to many mappings are maintained through the session events. | |
| mappingLogicalInsert | back to summary |
|---|---|
| public void mappingLogicalInsert(DataModifyQuery originalQuery, AbstractRecord arguments, AbstractSession session) INTERNAL: Performs a logical insert into the historical schema. Direct collections and many to many mappings are maintained through the session events. | |
| postDelete | back to summary |
|---|---|
| public void postDelete(ModifyQuery deleteQuery) INTERNAL: | |
| postInsert | back to summary |
|---|---|
| public void postInsert(ObjectLevelModifyQuery writeQuery) INTERNAL: | |
| postUpdate | back to summary |
|---|---|
| public void postUpdate(ObjectLevelModifyQuery writeQuery) INTERNAL: | |
| postUpdate | back to summary |
|---|---|
| public void postUpdate(ObjectLevelModifyQuery writeQuery, boolean isShallow) INTERNAL: | |
| setDescriptor | back to summary |
|---|---|
| public void setDescriptor(ClassDescriptor descriptor) PUBLIC: | |
| setEndFields | back to summary |
|---|---|
| protected void setEndFields(List<DatabaseField> endFields) INTERNAL: | |
| setEndFieldType | back to summary |
|---|---|
| public void setEndFieldType(String fieldName, Class<?> type) ADVANCED:
| |
| setHistoricalTables | back to summary |
|---|---|
| public void setHistoricalTables(List<DatabaseTable> historicalTables) INTERNAL: | |
| setMapping | back to summary |
|---|---|
| public void setMapping(DatabaseMapping mapping) INTERNAL: | |
| setShouldHandleWrites | back to summary |
|---|---|
| public void setShouldHandleWrites(boolean value) Sets if TopLink is responsible for writing history. If history is maintained via low level database triggers or application logic a policy is still needed for point in time querying. If Oracle flashback is used no HistoryPolicy is needed. Setting this to false lets you use History for many other applications. For instance a table that tracks available flights or hotel deals may benefit from a HistoryPolicy just to simplify temporal querying. If all hotel discounts have a start and end date, you could query on all discounts available at a certain date. | |
| setShouldUseDatabaseTime | back to summary |
|---|---|
| public void setShouldUseDatabaseTime(boolean value) Sets if the Timestamp used in maintainaing history should be the current time according to the database.
| |
| setStartFields | back to summary |
|---|---|
| protected void setStartFields(List<DatabaseField> startFields) INTERNAL: | |
| setStartFieldType | back to summary |
|---|---|
| public void setStartFieldType(Class<?> type) ADVANCED: Sets the type of all start fields. Not required to be set as the default of Timestamp is assumed. | |
| shouldHandleWrites | back to summary |
|---|---|
| public boolean shouldHandleWrites() Answers if TopLink is responsible for writing history. If history is maintained via low level database triggers or application logic a policy is still usefull for point in time querying. If Oracle flashback is used no HistoryPolicy is needed.
| |
| shouldUseDatabaseTime | back to summary |
|---|---|
| public boolean shouldUseDatabaseTime() Answers if the Timestamp used in maintaining history should be the current time according to the database.
| |
| shouldUseLocalTime | back to summary |
|---|---|
| public boolean shouldUseLocalTime() Answers if the Timestamp used in maintaining history should be System.currentTimeMillis();
| |
| useDatabaseTime | back to summary |
|---|---|
| public void useDatabaseTime() Answers if the Timestamp used in maintaining history should be the current time according to the database.
| |
| useLocalTime | back to summary |
|---|---|
| public void useLocalTime() Answers if the Timestamp used in maintaining history should be System.currentTimeMillis();
| |
| verifyTableQualifiers | back to summary |
|---|---|
| protected void verifyTableQualifiers(DatasourcePlatform platform) INTERNAL: Check that the qualifiers on the historical tables are properly set. A similar method exists on ClassDescriptor. | |