Question

I have the following classes:

Class SearchTemplateDO [ Abstract ]
{
 Relationship QueryParts As QueryPartDO [ Cardinality = many, Inverse = SearchTemplate ];
}

Class MyCustomSearchDO Extends (%Persistent, SearchTemplateDO)
{
 /// inherits all properties / relationships from SearchTemplateDO
}

Class QueryPartDO Extends %Persistent
{
   ...

    Relationship SearchTemplate As SearchTemplateDO 
     [ Cardinality = one, Inverse = QueryParts ];

    Index SearchTemplateIndex On SearchTemplate;
}

When I look at these two tables in SQL I see that QueryPartDO's SearchTemplate field is empty and when I look at MyCustomSearchDO I do not see a "QueryParts" field, although both tables have data

Was it helpful?

Solution 3

In the end I was able to get this to work by extending %Persistent on the abstract class. Before when I tried it, nothing was working and I kept getting a strange error. However, I tried this in a sample project and now it works.

OTHER TIPS

from documentation

The MANY or CHILD side is not projected as a field, since these relationships are stateless on disk and SQL does not deal with in-memory objects. Instead, you must perform a simple join based on the ONE or CHILD side’s ID value and the MANY or PARENT side’s reference field:

You can't reference abstract parent in non-abstract child class, because abstract classes have no storage strategy defined. Both classes in relationship have to be either abstract (in this case there is no data stored at all) or non-abstract (in this case you'll have proper storage strategy)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top