fix(core): resolve navigation-only nodes in template fragments - #365
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes query builder template fragments so that “navigation-only” paths (i.e., Navigable nodes produced when traversing beyond a Ref) are resolved to column references instead of falling through to bind-parameter compilation, aligning fragment behavior with full templates and predicate-style filters.
Changes:
- Updated
QueryModelImpl.resolveElementsto treatNavigablecolumn nodes like columns by rebuilding navigation-only nodes into resolvable runtimeMetamodelinstances viaMetamodel.of(root, fieldPath). - Updated
TemplatePreparation.collectReferencedTablePathsto record referenced paths forNavigablecolumn nodes in template fragment values so join derivation works beyondRef. - Added an integration test ensuring
where(raw(...))fragment behavior matches the predicate form for a beyond-Refcolumn path.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| storm-core/src/main/java/st/orm/core/template/impl/QueryModelImpl.java | Resolves Navigable column nodes in template fragment values into Elements.Column via a rebuilt runtime Metamodel. |
| storm-core/src/main/java/st/orm/core/template/impl/TemplatePreparation.java | Collects referenced table paths for Navigable column nodes inside template fragment values to derive required joins. |
| storm-core/src/test/java/st/orm/core/RefGraphTraversalIntegrationTest.java | Adds regression coverage comparing fragment-style where(raw(...)) against predicate-style filtering across a Ref. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Fixes #364.
A navigation-only node (a path that navigates beyond a
Refforeign key) interpolated into a query builder template fragment was not resolved to a column. It fell through to parameter compilation, so the raw metamodel object reached the JDBC driver (Type NavigableSiteMetamodel$7 not supported typeon MariaDB,NotSerializableExceptionon H2). The predicate form and full select templates already handled the same path.Changes
QueryModelImpl.resolveElementsnow resolvesNavigablecolumn nodes the same wayTemplatePreparation.resolveElementsdoes: full metamodels pass through, navigation-only nodes are rebuilt into resolvable runtime metamodels viaMetamodel.of(root, fieldPath). Table-level paths get the same error message as the main template path.TemplateStringvalue walker inTemplatePreparation.collectReferencedTablePathsrecords the referenced path forNavigablecolumn nodes, so the joins beyond the reference are derived for template fragments. Without this, the resolved column failed withAlias for table not found.RefGraphTraversalIntegrationTest.testFilterThroughRefInWhereTemplatecompares the template fragment form against the predicate form; it reproduced both failure layers before the fix.Verification
./mvnw -pl storm-foundation,storm-core test: 2501 tests, 0 failures.