Written by

Question Martin Karas · Oct 1, 2019

NoExtent and object references

Hello,

lets have two  abstract %Persistent classes A,B with NoExtent keyword (storing data in separate globals for each subclass).

Class A Extends %Persistent [Abstract, NoExtent]

{

}

Class B Extends %Persistent [Abstract, NoExtent]

{

     Property Aref As A;

}

Let B class reference the A class. Since the A class has no extent the reference wont work in subclasses. It wont be even usable in SQL.  Is it possible to solve this problem? Whats the recommended way to deal with references/relationships using NoExtent?

Comments

Joel Solon · Oct 2, 2019

Why are you using NoExtent here?

0
Martin Karas  Oct 3, 2019 to Joel Solon

I want to keep the data in separate globals for each subclass. Do you have a better way to achieve that?

0
Benjamin De Boe  Oct 3, 2019 to Martin Karas

If you know which non-NoExtent (for lack of a YesExtent keyword :-) ) subclass of A you're targeting in B's subclass, you can override your property definition pointing to that subclass.

0
Martin Karas  Oct 3, 2019 to Benjamin De Boe

You would have to override it in every subclass for every reference property :) that defeats the purpose of defining it in superclass. But yes, you are right.

0
Joel Solon  Oct 3, 2019 to Martin Karas

OK. In your original post, you wrote "storing data in separate globals for each class" which made me ask my question. You should probably edit that to be "storing data in separate globals for each subclass".

And, yes, that is the correct way to achieve that.

0
Joel Solon · Oct 3, 2019

If you want to allow subclasses of class A with a property that references Abstract %Persistent Class B, and allow A objects to use that property to reference any of the subclasses of B, class B must have its own extent (all subclass data stored in the same global). Otherwise, since the A objects only store the ID of the referenced B objects, how would the system determine which subclass of B ID #52 refers to? When all the subclass data is stored in the same global, IDs are unique across all subclasses, and ID #52 refers to one object only.

Adding a BitMap extent index to class B helps compensate for the fact that all B objects are stored together, and improves the performance of queries on the subclasses.

0