25.01.2015 Views

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

If you would like to see schema evolution in action, then try the following:<br />

Schema Evolution<br />

1. Start <strong>Caché</strong> Studio and create a new persistent class with one or more properties in it.<br />

2. Compile the class and then view the automatically generated storage definition (as XML<br />

text) for the class using the View Storage command on the View menu. Alternatively, you<br />

can see a more graphical representation of storage using the Class Inspector. Click on<br />

Storage in the Inspector, click in “Default” in the list of Storage definitions, click on<br />

Data Nodes in the keyword list, and click on the browse button (...) that appears. This<br />

invokes a graphical storage editor.<br />

Within the generated storage for your class, you will see the pseudo-property<br />

%%CLASSNAME. This is a placeholder for the class name of any future subclasses you<br />

may derive from your class and is used to tell the type of objects stored in the database.<br />

For the root class of an extent, this value is always empty.<br />

3. Add one or more new properties to your class and compile it again. Notice that these new<br />

properties have been added to your storage definition automatically and in way that is<br />

compatible to the previously existing storage.<br />

12.5.1 Resetting the Storage Definition<br />

During the development process, you may make many modifications to your persistent classes:<br />

adding, modifying, and deleting properties. As a result, you may end up with a fairly convoluted<br />

storage definition as the Class Compiler attempts to maintain a compatible structure<br />

after each change. If you would like to have the Class Compiler regenerate a cleaner storage<br />

structure, simply delete the storage definition for the class and recompile it.<br />

You can do this as follows:<br />

1. Open the class in <strong>Caché</strong> Studio,<br />

2. Right-click on the default Storage definition in the Class Inspector,<br />

3. Invoke the Delete command in the popup menu, and,<br />

4. Compile the class. This will cause the Class Compiler to generate a new storage definition<br />

for the class.<br />

<strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong> 111

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!