Skip to content

Conversation

@dfcoffin
Copy link
Contributor

@dfcoffin dfcoffin commented Jan 8, 2026

Summary

This PR implements Phase 4 of ESPI 4.0 schema compliance, updating ReadingQuality to match the ESPI 4.0 XSD specification (espi.xsd:1062-1077).

Key Changes

ReadingQualityEntity:

  • Changed ID from UUID to Long (48+ bits) per Object pattern
  • ReadingQuality extends Object, not IdentifiedObject
  • Updated @GeneratedValue to use IDENTITY strategy
  • Removed UUID-related imports
  • Field order already correct (only quality field per XSD)

ReadingQualityDto:

  • ✅ Already compliant - no changes needed
  • Single quality field matches XSD specification

ReadingQualityMapper:

  • Simplified mappings (MapStruct handles field mapping by name)
  • Removed explicit quality field mapping
  • Kept only necessary ignore mappings (id, intervalReading)

Flyway Migrations:

  • Moved reading_qualities table from V3 to V2 vendor-specific files
  • Rationale: ReadingQuality requires vendor-specific auto-increment syntax:
    • MySQL/H2: BIGINT AUTO_INCREMENT
    • PostgreSQL: BIGSERIAL
  • Removed all IdentifiedObject fields (description, created, updated, published, links)
  • Updated V3 header to document table relocation
  • Completed dependency chain: meter_readings → interval_blocks → interval_readings → reading_qualities

Test Plan

✅ All 550 unit and integration tests passing

  • PostgreSQL TestContainer integration tests: ✅
  • MySQL TestContainer integration tests: ✅
  • H2 in-memory integration tests: ✅
  • Complex relationship integration tests: ✅

Technical Details

XSD Reference: espi.xsd:1062-1077

<xs:complexType name="ReadingQuality">
  <xs:complexContent>
    <xs:extension base="Object">
      <xs:sequence>
        <xs:element name="quality" type="QualityOfReading"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

Files Changed:

  • ReadingQualityEntity.java - Changed ID type to Long
  • ReadingQualityMapper.java - Simplified mappings
  • V3__Create_additiional_Base_Tables.sql - Relocated table, updated header
  • V2__MySQL_Specific_Tables.sql - Added reading_qualities
  • V2__PostgreSQL_Specific_Tables.sql - Added reading_qualities
  • V2__H2_Specific_Tables.sql - Added reading_qualities

Migration Strategy

  • V1: Base vendor-neutral tables
  • V2: Vendor-specific tables (now includes complete chain: meter_readings, interval_blocks, interval_readings, reading_qualities)
  • V3: Additional tables that depend on V1 and V2

Related

🤖 Generated with Claude Code

This commit implements Phase 4 of ESPI 4.0 schema compliance, updating
ReadingQuality to match the ESPI 4.0 XSD specification (espi.xsd:1062).

Key Changes:

ReadingQualityEntity:
- Changed ID from UUID to Long (48+ bits) per Object pattern
- ReadingQuality extends Object, not IdentifiedObject
- Updated @GeneratedValue to use IDENTITY strategy
- Removed UUID-related imports (JdbcTypeCode, SqlTypes)
- Field order already correct (only has quality field per XSD)

ReadingQualityDto:
- Already compliant - no changes needed
- Single quality field matches XSD specification

ReadingQualityMapper:
- Simplified mappings (MapStruct handles by name)
- Removed explicit quality field mapping
- Kept only necessary ignore mappings (id, intervalReading)

Flyway Migrations:
- Moved reading_qualities table from V3 to V2 vendor-specific files
- Rationale: ReadingQuality requires vendor-specific auto-increment
  syntax (BIGINT AUTO_INCREMENT for MySQL/H2, BIGSERIAL for PostgreSQL)
- Removed all IdentifiedObject fields (description, created, updated,
  published, links) from table structure
- Updated V3 header to document reading_qualities relocation
- Added to dependency chain: meter_readings → interval_blocks →
  interval_readings → reading_qualities

Test Results:
- All 550 tests passing including integration tests
- PostgreSQL TestContainer integration tests: ✅
- MySQL TestContainer integration tests: ✅
- H2 in-memory integration tests: ✅

Migration Strategy:
- V1: Base vendor-neutral tables
- V2: Vendor-specific tables (now includes meter_readings, interval_blocks,
  interval_readings, reading_qualities with correct auto-increment syntax)
- V3: Additional tables that depend on V1 and V2

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@dfcoffin dfcoffin merged commit 2df782c into main Jan 8, 2026
5 checks passed
@dfcoffin dfcoffin deleted the feature/schema-compliance-phase-4-reading-quality branch January 8, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants