feat(mybatis): index <resultMap> and link statements that use it (#592)#595
Open
maxmilian wants to merge 1 commit into
Open
feat(mybatis): index <resultMap> and link statements that use it (#592)#595maxmilian wants to merge 1 commit into
maxmilian wants to merge 1 commit into
Conversation
fe8f76b to
b488957
Compare
…bymchenry#592) The MyBatis XML extractor indexed <select|insert|update|delete|sql> but not <resultMap>, so "which statements use this result map" queries found nothing. Index each <resultMap id="..."> as a node (same method-shaped model as the existing statements/sql fragments, qualified <namespace>::<id>) and emit a reference from any statement carrying resultMap="..." to it — mirroring the existing <include refid> → <sql> link. Also guard the Java↔XML bridge: it suffix-matches xml method nodes by <Class>::<id>, so without a filter a Java method whose name collides with a <sql>/<resultMap> id would wrongly bridge to it. Skip those non-statement nodes (identified by signature) — only real statements map to Java methods. Tests: a <resultMap> is indexed and a <select resultMap="..."> links to it, and a same-named Java method does NOT bridge to the result map. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
b488957 to
a9a5b47
Compare
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.
Summary
Fixes #592. The MyBatis XML extractor indexes
<select|insert|update|delete|sql>but not<resultMap>, so "which statements use this result map" queries return nothing.(Note:
<sql>fragments raised in the original report are already indexed on currentmain— this PR adds the remaining<resultMap>piece.)Fix
src/extraction/mybatis-extractor.tsresultMapto the element scan, so each<resultMap id="...">becomes a node — the same method-shaped model already used for statements and<sql>fragments, qualified<namespace>::<id>, with acontainsedge from the file. No new node kind.resultMap="..."to that result-map node, mirroring the existing<include refid="...">→<sql>link.src/resolution/callback-synthesizer.ts<Class>::<id>; without a filter, a Java method whose name collides with a<sql>/<resultMap>id would wrongly bridge to it. Skip those non-statement nodes (identified by signature) — only real statements correspond to Java mapper methods. (This also closes the same latent over-bridge for<sql>fragments.)This lets
callers/impact/traceanswer "which statements use this result map".Tests (
__tests__/frameworks-integration.test.ts)<resultMap id="userResult">is indexed (qualified…UserMapper::userResult, signature<resultMap> type=User).<select resultMap="userResult">produces an edge to that result map.userResultdoes not bridge to the result map (guard verified).Full suite green locally (
npm test).Scope
Result-map-level linkage only. Field-level mapping (
<result column=… property=…>/<id>entries as individual nodes — the "specific field → methods" association in the issue) is not modeled here; that needs a column/property node kind and is a larger design decision. Happy to follow up if you want that granularity.<resultMap extends="…">inheritance is likewise left for a follow-up.