|
Oracle Fusion Middleware Java API Reference for Oracle TopLink 11g Release 1 (11.1.1) B32476-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.toplink.history.HistoryPolicy
public class HistoryPolicy
Purpose:Expresses how historical data is saved on the data store.
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.
Constructor Summary | |
---|---|
HistoryPolicy()
|
Method Summary | |
---|---|
void |
addEndFieldName(java.lang.String endFieldName)
|
void |
addHistoryTableName(java.lang.String name)
Use to specify the names of the mirroring historical tables. |
void |
addHistoryTableName(java.lang.String sourceTableName,
java.lang.String historyTableName)
Use to specify the names of the mirroring historical tables. |
void |
addStartFieldName(java.lang.String startFieldName)
Sets the name of the start field. |
java.lang.Object |
clone()
Performs a sufficiently deep clone. |
java.lang.Object |
getCurrentTime(oracle.toplink.internal.sessions.AbstractSession session)
Whenever a historical record is logically deleted (updated) or inserted, the end and start fields respectively will be set to this value. |
ClassDescriptor |
getDescriptor()
Return the descriptor of the policy. |
java.lang.String |
getEndFieldName()
|
java.util.Vector |
getHistoryTableNames()
|
DatabaseMapping |
getMapping()
|
java.lang.String |
getStartFieldName()
Answers the name of the start field. |
void |
setDescriptor(ClassDescriptor descriptor)
|
void |
setEndFieldType(java.lang.String fieldName,
java.lang.Class type)
ADVANCED: |
void |
setShouldHandleWrites(boolean value)
Sets if TopLink is responsible for writing history. |
void |
setShouldUseDatabaseTime(boolean value)
Sets if the Timestamp used in maintainaing history should be the current time according to the database. |
void |
setStartFieldType(java.lang.Class type)
ADVANCED: Sets the type of all start fields. |
boolean |
shouldHandleWrites()
Answers if TopLink is responsible for writing history. |
boolean |
shouldUseDatabaseTime()
Answers if the Timestamp used in maintaining history should be the current time according to the database. |
boolean |
shouldUseLocalTime()
Answers if the Timestamp used in maintaining history should be System.currentTimeMillis(); |
void |
useDatabaseTime()
Answers if the Timestamp used in maintaining history should be the current time according to the database. |
void |
useLocalTime()
Answers if the Timestamp used in maintaining history should be System.currentTimeMillis(); |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HistoryPolicy()
Method Detail |
---|
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.Object getCurrentTime(oracle.toplink.internal.sessions.AbstractSession session)
public ClassDescriptor getDescriptor()
public java.util.Vector getHistoryTableNames()
public DatabaseMapping getMapping()
public java.lang.String getStartFieldName()
public java.lang.String getEndFieldName()
public void setDescriptor(ClassDescriptor descriptor)
public void addHistoryTableName(java.lang.String name)
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().
public void addHistoryTableName(java.lang.String sourceTableName, java.lang.String historyTableName)
Explicitly states that sourceTableName
is mirrored by history table
historyTableName
.
The order in which tables are added with descriptor.addTableName()
should still match the order in which mirroring historical tables are
added with descriptor.addMirroringHistoryTableName().
public void addStartFieldName(java.lang.String startFieldName)
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 startFieldName
is qualified, i.e. of the form
"EMPLOYEE_HIST.EMP_START", then this call will only set the start field
name for a single historical table.
public void setStartFieldType(java.lang.Class type)
public void addEndFieldName(java.lang.String endFieldName)
addStartFieldName(java.lang.String)
public void setEndFieldType(java.lang.String fieldName, java.lang.Class type)
setStartFieldType(java.lang.Class)
public void setShouldHandleWrites(boolean value)
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.
public boolean shouldHandleWrites()
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.
setShouldHandleWrites(boolean)
public void setShouldUseDatabaseTime(boolean value)
value
- if false uses localTime (default) insteadpublic boolean shouldUseLocalTime()
shouldUseDatabaseTime()
,
useLocalTime()
public boolean shouldUseDatabaseTime()
shouldUseLocalTime()
,
useDatabaseTime()
public void useLocalTime()
useDatabaseTime()
,
shouldUseLocalTime()
public void useDatabaseTime()
useLocalTime()
,
shouldUseDatabaseTime()
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |