-
Notifications
You must be signed in to change notification settings - Fork 26
hs230
Here is a snippet from an example class definition with external attributes. The storage name for the class TTest is assumed to be Test:
TTest2 = class(TInstantObject)
{IOMETADATA stored;
TestPart: Part(TTest) external;
TestParts: Parts(TTest) external 'Test2_TestParts';
TestRef: Reference(TTest);
TestRefs: References(TTest) external 'Test2_TestRefs'; }
The TestPart attribute is an external part attribute, which results in a mapping very similar to TestRef. Instead of having a blob field called TestPart, the Test2 table has two reference fields, TestPartId and TestPartClass, and the referenced TTest object's attributes are stored as a record in the Test table .
The TestParts external attribute results in the creation of a linking table named Test2_TestParts which has relationships with both Test2 andTest: Test2 --1:N--> Test2_TestParts --1:1--> Test. The Test2_TestParts linking table has fields to hold information about both the relationships and the sequence of elements in the TestPart sattribute.
The mapping of the TestRefs attribute is very similar to that for the TestParts attribute. The only difference is that the TestParts attribute's Test table records are deleted when the related Test2 table record is deleted. This cascade delete process, of course, does not happen with the TestRefs attribute's Test table records.
- Home
- Glossary
- Project structure
- Installing InstantObjects
- User Guide for InstantObjects
- Creating the Business Model
- Creating the User Interface
- Programming with Persistent Objects
- Learning the Primer Demo