Class SqaleTableMapping<S,​Q extends FlexibleRelationalPathBase<R>,​R>

  • Type Parameters:
    S - schema type
    Q - type of entity path
    R - row type related to the SqaleTableMapping
    All Implemented Interfaces:
    SqaleMappingMixin<S,​Q,​R>
    Direct Known Subclasses:
    QAuditDeltaMapping, QAuditEventRecordMapping, QAuditRefValueMapping, QContainerMapping, QObjectMapping, QReferenceMapping

    public abstract class SqaleTableMapping<S,​Q extends FlexibleRelationalPathBase<R>,​R>
    extends QueryTableMapping<S,​Q,​R>
    implements SqaleMappingMixin<S,​Q,​R>
    Mapping superclass with common functions for QObject and non-objects (e.g. containers). See javadoc in QueryTableMapping for more. Mappings are typically initialized using static `init*(repositoryContext)` methods, various suffixes are used for these reasons: * To differentiate various instances for the same mapping type, e.g. various references stored in separate tables. * To avoid return type clash of the `init` methods in the hierarchy. Even though they are static and technically independent, Java meddles too much. * And finally, to avoid accidental use of static method from the superclass (this should not be even a thing!). For object mappings the reuse is not that important and mapping is simply reinitialized. For container and ref mappings the same instance can be reused from various subclasses of object mapping and reuse is desired. Initialization method does not check only `null` but also forces reinitialization if different `repositoryContext` is provided; this is only used for testing purposes. Mappings are not built to be run with multiple repository contexts in the same runtime. [IMPORTANT] ==== The mappings are created in the constructors and subtypes depend on their supertypes and objects depend on their parts (container/ref tables). This does not create any confusion and `init` methods can be called multiple times from various objects, whatever comes first initializes the mapping and the rest reuses it. *But cross-references can cause recursive initialization and stack overflow* and must be solved differently, either after all the mappings are initialized or the mappings must be provided indirectly/lazily, e.g. using Supplier, etc. ====
    See Also:
    QueryTableMapping