beautypg.com

Define all rwcollectables that will be restored – HP Integrity NonStop J-Series User Manual

Page 211

background image

Define All RWCollectables That Will Be Restored

Make certain that your program declares variables of all possible

RWCollectable

objects that you

might restore. For an example of this practice, see

example 2

, above.

These declarations are of particular concern when you save an

RWCollectable

in a collection,

then attempt to take advantage of polymorphic persistence by restoring the collection in a
different program, without using the RWCollectable that you saved. If you don't declare the
appropriate variables, during the restore attempt the

RWFactory

will throw an RW_NOCREATE

exception for some RWCollectable class ID that you know exists. The RWFactory won't throw
an RW_NOCREATE exception when you declare variables of all the RWCollectables that could
be polymorphically restored.

The problem occurs because your compiler's linker only links the code that

RWFactory

needs to

create the missing

RWCollectable

when that RWCollectable is specifically mentioned in your

code. Declaring the missing RWCollectables gives the linker the information it needs to link the
appropriate code needed by RWFactory.

This manual is related to the following products: