Files
qbit-template-data/docs/01-data-qbit-architecture.md
james.maes b8ed33985d feat(release): migrate data template to QQQ 4.0 (#4)
* fix(template): complete QQQ 4.0 data migration

* fix(ci): avoid interactive package restart prompts

* docs: align guides and examples with QQQ 4.0

* docs(release): finalize QQQ 4.0 template instructions

Refs QRun-IO/qqq#631.
2026-09-24 13:32:11 -05:00

1.5 KiB

Data QBit Architecture

Table Prefixing

The producer can prefix metadata names. Prefixing alone does not guarantee multiple independent instances: review process names, relationships and any hard-coded table references before registering more than one instance.

public String applyPrefix(String tableName)
{
   if(StringUtils.hasContent(tableNamePrefix))
   {
      return tableNamePrefix + "_" + tableName;
   }
   return tableName;
}

Result:

  • No prefix: country, state_province
  • With "shipping" prefix: shipping_country, shipping_state_province

Scope Tracking

All metadata is marked with source QBit via SourceQBitAware:

if(output instanceof SourceQBitAware sqa)
{
   sqa.setSourceQBitName(qBitMetaData.getName());
}

Natural Keys

Each table defines a natural key for upsert matching:

Table Natural Key
exampleEntity code
exampleChildEntity exampleEntityId + code

Entity Pattern

@QMetaDataProducingEntity(producePossibleValueSource = true)
public class ExampleEntity extends QRecordEntity
{
   public static final String TABLE_NAME = "exampleEntity";

   @QField(isPrimaryKey = true)
   private Integer id;

   @QField(isRequired = true, maxLength = 10)
   private String code;  // Natural key

   @QField
   private Boolean isActive = true;  // Used by the sync process's explicit deactivation logic
}

An isActive field is not a global soft-delete facility. Add appropriate query filters and application behavior for inactive rows.