Interface IMappingStrategySchemaPreflight


public interface IMappingStrategySchemaPreflight
An optional mapping-strategy extension for preparing the physical database schema of a commit before transactional CDO data is written.

A mapping strategy that implements this interface is called by the store accessor during the schema-preparation phase of a commit. The call takes place after mapping objects for newly encountered package units have been created and before commit metadata, revisions, attributes, or list values are written. Implementors can therefore create all class tables, list tables, indexes, and other mapping-specific schema objects required by the supplied write set while the accessor's JDBC connection contains no pending transactional CDO data.

This phase boundary is important for database adapters whose DDL commits implicitly or for the schema transaction implementation that explicitly commits its connection. Once transactional data writing has started, mapping code must not defer required schema creation to a later write operation. A successful return from this method is the strategy's declaration that all schema needed by its normal write path has been prepared. Schema objects may remain in the database when the subsequent CDO transaction is cancelled; the CDO data itself remains subject to the normal commit or rollback semantics.

Mapping-strategy decorators should expose this capability through their effective delegate so that the store can discover it with IMappingStrategy.getEffectiveMappingStrategy(IMappingStrategy).

Since:
4.15
Author:
Eike Stepper
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    prepareSchema(IDBStoreAccessor accessor, CDORevision[] newObjects, CDORevision[] dirtyObjects, CDORevisionDelta[] dirtyObjectDeltas, org.eclipse.net4j.util.om.monitor.OMMonitor monitor)
    Prepares every physical schema object that may be accessed while writing the supplied commit.
  • Method Details

    • prepareSchema

      void prepareSchema(IDBStoreAccessor accessor, CDORevision[] newObjects, CDORevision[] dirtyObjects, CDORevisionDelta[] dirtyObjectDeltas, org.eclipse.net4j.util.om.monitor.OMMonitor monitor)
      Prepares every physical schema object that may be accessed while writing the supplied commit.

      Implementations should use the given accessor for schema creation and report progress through the supplied monitor. The method must finish all required schema work before returning. It must not write transactional CDO data and should leave the mapping objects in the same initialized state that the subsequent write methods expect.

      Parameters:
      accessor - the store accessor and JDBC connection that will write the commit data; schema preparation must use this accessor so that all mapping state is initialized for the following write phase.
      newObjects - the complete revisions of objects newly attached by the commit.
      dirtyObjects - the complete revisions of existing objects revised by the commit.
      dirtyObjectDeltas - the deltas of existing objects written by a delta-capable mapping strategy.
      monitor - the monitor used to report preparation progress and cancellation.