Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Object Synchronization<br />
This functionality prevents creating infinite loops in which two databases continually update<br />
each other with the same set of transactions.<br />
17.2 Running an Update<br />
This process involves preparing for the update and then running the update itself.<br />
17.2.1 Preparing for the Update<br />
Object synchronization requires that the sites have data with matching sets of GUIDs. If you<br />
are starting with an already-existing database that does not yet have GUIDs assigned for its<br />
records, you need to assign a GUID to each instance (record) in the database, and then make<br />
sure there are matching copies of the database on each site. In detail, the process is:<br />
1. For each class being synchronized, set the value of the OBJJOURNAL parameter to 1 or<br />
2. This activates the logging of filing operations (that is, insert, update, or delete) within<br />
each transaction; this information is stored in the ^OBJ.JournalT global.<br />
If OBJJOURNAL equals 1, then the property values that are changed in filing operations<br />
are stored in the system journal file; during synchronization, data that needs to be synchronized<br />
is retrieved from that file.<br />
If OBJJOURNAL equals 2, then the property values that are changed in filing operations<br />
are stored in the ^OBJ.Journal global; during synchronization, data that needs to be<br />
synchronized is retrieved from that global. Note that storing information in the global<br />
increases the size of the database very quickly.<br />
2. For each class being synchronized, set the value of its GUIDENABLED parameter to 1;<br />
this tells <strong>Caché</strong> to allow the class to be stored with GUIDs. You can do this in Studio,<br />
adding the following line to the class definition:<br />
Parameter GUIDENABLED = 1;<br />
Note that if this value is not set, the synchronization does not work properly. Also, you<br />
must set GUIDENABLED for serial classes, but not for embedded objects.<br />
3. For each class being synchronized, give each object instance its own GUID by running<br />
the AssignGUID method:<br />
Set Status = ##Class(%Library.GUID).AssignGUID(classname,displayoutput)<br />
where<br />
150 <strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong>