Skip to content

Conversation

@dfcoffin
Copy link
Contributor

@dfcoffin dfcoffin commented Jan 9, 2026

Summary

Implements ESPI 4.0 schema compliance for AggregatedNodeRef (espi.xsd:1570-1601).

This phase addresses a critical XSD compliance issue: per ESPI 4.0 XSD line 1597, pnodeRef has minOccurs="0" maxOccurs="unbounded", requiring support for 0 to many pricing node references.

Key Changes

1. ID Type Migration

  • Changed from UUID to Long (AggregatedNodeRef extends Object, not IdentifiedObject)
  • Uses GenerationType.IDENTITY with vendor-specific auto-increment

2. PnodeRef Relationship Fix (XSD Compliance)

  • Before: @ManyToOne - single PnodeRefEntity
  • After: @ManyToMany - List
  • Added join table: aggregated_node_ref_pnode_refs
  • Supports 0 to many pricing nodes per XSD specification

3. Database Schema

  • Moved aggregated_node_refs table from V3 to vendor-specific V2 migrations
  • Added aggregated_node_ref_pnode_refs join table with:
    • Composite primary key: (aggregated_node_ref_id, pnode_ref_id)
    • CASCADE delete on both foreign keys
    • Proper indexes on both columns

4. Repository Optimization

  • Removed 13 non-indexed custom queries
  • Kept only 2 indexed queries:
    • findAllIds() - All IDs
    • findAllByUsagePointId() - By usage point (foreign key index)

5. Mapper Simplification

  • Removed updateEntity method (read-only operations)
  • Updated mappings: pnodeRefpnodeRefs

Files Changed

Entity & Domain:

  • AggregatedNodeRefEntity.java - Long ID, List with @manytomany

DTO:

  • AggregatedNodeRefDto.java - List for XML marshalling
  • AggregatedNodeRefsDto.java - Updated factory methods

Mapper:

  • AggregatedNodeRefMapper.java - Removed updateEntity, updated field mappings

Repository:

  • AggregatedNodeRefRepository.java - Long ID, 2 indexed queries only

Database Migrations:

  • V3__Create_additiional_Base_Tables.sql - Removed aggregated_node_refs
  • V2__MySQL_Specific_Tables.sql - Added aggregated_node_refs + join table
  • V2__PostgreSQL_Specific_Tables.sql - Added aggregated_node_refs + join table
  • V2__H2_Specific_Tables.sql - Added aggregated_node_refs + join table

Tests:

  • AggregatedNodeRefRepositoryTest.java - Comprehensive test coverage for List relationships

Test Results

✅ All 537 tests pass

  • 9 AggregatedNodeRef tests (including multi-PnodeRef relationship tests)
  • All integration tests (H2, MySQL, PostgreSQL) pass
  • Flyway migrations validated

Test Plan

  • Unit tests for AggregatedNodeRef CRUD operations
  • Repository query tests (findAllIds, findAllByUsagePointId)
  • Many-to-many relationship tests (multiple PnodeRefs per AggregatedNodeRef)
  • Business logic tests (validity, display names)
  • Integration tests with all databases (H2, MySQL 8.0/9.5, PostgreSQL 18)
  • Flyway migration validation

🤖 Generated with Claude Code

Implements ESPI 4.0 schema compliance for AggregatedNodeRef (espi.xsd:1570-1601):

Key Changes:
- Changed ID from UUID to Long (extends Object, not IdentifiedObject)
- Fixed PnodeRef relationship: @manytoone@manytomany with join table
  (Per XSD line 1597: pnodeRef has minOccurs="0" maxOccurs="unbounded")
- Moved table creation to vendor-specific V2 migrations (auto-increment)
- Removed 13 non-indexed repository queries, kept only 2 indexed queries
- Removed updateEntity mapper method (read-only operations)

Entity Changes:
- AggregatedNodeRefEntity: UUID id → Long id, PnodeRefEntity → List<PnodeRefEntity>
- Added @manytomany join table: aggregated_node_ref_pnode_refs

DTO Changes:
- AggregatedNodeRefDto: PnodeRefDto → List<PnodeRefDto>
- Updated all constructors and factory methods

Database Changes:
- Removed aggregated_node_refs from V3 (vendor-neutral)
- Added to V2 MySQL/PostgreSQL/H2 with proper BIGINT AUTO_INCREMENT/BIGSERIAL
- Added aggregated_node_ref_pnode_refs join table with composite primary key

Tests:
- Updated AggregatedNodeRefRepositoryTest with comprehensive test coverage
- All 537 tests pass

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@dfcoffin dfcoffin merged commit cd53b6d into main Jan 10, 2026
5 checks passed
@dfcoffin dfcoffin deleted the feature/schema-compliance-phase-9-aggregated-node-ref branch January 10, 2026 06:13
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