Repository navigation
fix(refraction): a DFHCOMMAREA maps to a DTO, not a JPA entity (#3233) - #3239
Merged
Merged
Conversation
Every CICS program declares a DFHCOMMAREA -- its communication area, a transient parameter block, not a shared table. Since #3231 named each generated class from its clean-room key, CBSA emitted 20 entity classes all bound to @table(name = "DFHCOMMAREA") (26 layouts were being discarded before #3231, across all three colliding titles). Hibernate refuses to start on "Multiple entities mapped to table DFHCOMMAREA", so the generated tree could not boot. A record whose 01-level title is DFHCOMMAREA now generates a plain Lombok POJO DTO in the .dto package: @DaTa @NoArgsConstructor, no @Entity/@table, no synthetic @id, no @Column/@Transient/@ElementCollection, no jakarta.persistence import. The COBOL layout (field order, BigDecimal precision, OCCURS as List<>, REDEFINES aliases) is preserved as plain fields, since the block is still read and written by the migrated logic -- it is simply not persisted. - forge: is_transient_record + generate_java_dto + dto_class_name; the per-field rendering is factored into a shared _render_field(jpa=bool) helper, so the entity path stays byte-identical (golden image unchanged). - controller: dto/ scaffold dir, schema-loop branch, "Transient DTOs" count. - tests: new DTO golden image; the #3221 collision test now asserts one distinct DTO per clean-room key with no entity generated. - refraction snapshots re-blessed (excerpts + full corpora); no @table(name = "DFHCOMMAREA") remains anywhere. - docs/refraction_engine_differential.md: new section closing the "tracked separately" caveat the #3221 update left open, and corrects that section's DFHCOMMAREA-class count (20, not 26). The lineage-gated rule (persist only records a program reads/writes to a file) is the more faithful successor, blocked on #3201; other working-storage records stay entities until then. Compiling the generated tree is tracked in #3121. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01MnydTpQgzRShNDhfe3WXf7
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3233. Part of the CICS modernization epic #3122.
Problem
Every CICS program declares a
DFHCOMMAREA— its communication area, a transient parameter block, not a shared table. Since #3231 named each generated Java class from its clean-room key, CBSA emitted 20 entity classes all bound to@Table(name = "DFHCOMMAREA")(the issue/#3221 prose said "26"; that 26 is the layouts discarded pre-#3231 across all three colliding titles — see the count fix below). Hibernate refuses to start onMultiple entities mapped to table DFHCOMMAREA, so the generated Spring Boot tree could not boot.This is the "deciding what table each should map to is a semantic question, tracked separately" caveat the #3221 differential-doc update explicitly left open.
The rule
A record whose 01-level title is
DFHCOMMAREAis transient state and now generates a plain Lombok POJO DTO in the.dtopackage instead of a JPA entity:@Data @NoArgsConstructor, no@Entity/@Table, no synthetic@Id, no@Column/@Transient/@ElementCollection, nojakarta.persistenceimport. The COBOL layout (field order,BigDecimalprecision, OCCURS asList<>, REDEFINES aliases) is preserved as plain fields — the block is still read/written by the migrated logic, it is simply not persisted. The class keeps its clean-room-keyed name with aDtosuffix (Bnk1cacDfhcommareaDto).Changes
cobol_to_java_spring_forge.py):is_transient_record,generate_java_dto,dto_class_name; per-field rendering factored into a shared_render_field(jpa=bool)helper so the entity path stays byte-identical (golden image unchanged).dto/scaffold dir, schema-loop branch, a "Transient DTOs Generated" audit/console count.grepconfirms zero@Table(name = "DFHCOMMAREA")remain.refraction_engine_differential.md): new section documenting the rule; also corrects the cobol-to-java: same-name programs collapse into one Service/Controller (the Java side of #3218) #3221 section's DFHCOMMAREA-class count (20, not 26).Totals unchanged from the #3221 table; the DFHCOMMAREA rows moved from
entity/todto/. No generated service/controller/repository referenced these classes, so nothing else moved except the per-corpus audit count line.Scope / follow-ups
WS_FIELDS,PARM_BUFFER, …) stay entities.Verification
pytest tests/cobol_mainframe/ tests/tools_recorders/→ all pass (entity golden byte-identical, new DTO golden, snapshot suite, updated collision test).ruff_audit.py --cino new findings;mypy_audit.py --cino new errors.🤖 Generated with Claude Code
https://claude.ai/code/session_01MnydTpQgzRShNDhfe3WXf7