# db-schema-map: Schema Map from MyBatis & JPA

> Map every table your Spring code touches, straight from MyBatis XML or JPA entities, with no database connection.

db-schema-map: Schema Map from MyBatis & JPA is a free AI agent skill on Agensi by 박찬혁, in APIs & Backend. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [박찬혁](https://www.agensi.io/creators/koclam98)
- Category: [APIs & Backend](https://www.agensi.io/skills/apis-backend)
- Uses: 2
- Version: 1.0
- Last updated: 2026-10-17
- Security: scan passed (2026-10-17); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/db-schema-map-schema-map-from-mybatis-jpa
- Tags: api, spring-boot, mybatis, jpa, hibernate, database

## About this skill

Reverse-engineering a legacy database schema from a large Spring codebase is slow, especially without a live database connection. This skill builds a table-centric schema map by statically analyzing MyBatis XML mappers and JPA/Hibernate entities. It extracts table relationships, column definitions, and CRUD access patterns directly from the source code.

### What it does
- **ORM auto-detection** identifies MyBatis or JPA/Hibernate configurations to apply the correct parsing logic.
- **Dependency mapping** resolves table relationships and N:N join tables from `@JoinTable` or MyBatis ON clauses.
- **Impact analysis** tracks call sites for specific tables to determine the blast radius of a schema change.
- **Risk signaling** flags blind spots like SQL injection risks in `${}` substitutions or hidden QueryDSL queries.
- **CRUD profiling** categorizes table usage by SELECT, INSERT, UPDATE, and DELETE operations.

### How it works
1. Run the script against a project root to generate a full domain map.
2. Target a specific table name to see every DAO method or Repository call touching that data.
3. Export results to JSON for machine-readable integration with other internal tooling.
4. Review the Signals section to gauge code quality and naming strategy confidence.

### Frameworks & tools
Python 3.8+ standard library. Works with Spring Boot, MyBatis, JPA, and Hibernate. Supports Flyway and Liquibase detection.

### Why this beats prompting it yourself
Manual prompts struggle to maintain state across hundreds of XML and Java files, often missing aliased joins or dynamic SQL tags. This tool uses structured regex scanning to ensure every `DAO.statementId` and Repository method is accounted for without losing context.

### Use cases
- **Onboarding** to an unfamiliar project by identifying the top 5 core domain tables.
- **Pre-migration audits** to find all code paths affected by renaming a column or table.
- **Security reviews** to locate every instance of unsafe string substitution in MyBatis.
- **Performance tuning** by identifying EAGER fetch types and N+1 risks in JPA entities.

### Known limitations
Uses regex scanning rather than full SQL/Java parsing. Accuracy is not compiler-grade. MyBatis column extraction is limited to write paths. Does not detect QueryDSL or Criteria API query logic.

## Requires

- Python

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the db-schema-map: Schema Map from MyBatis & JPA skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### Do I need a live connection to my database for this skill to work?

No database connection is required. This skill uses static analysis to extract schema information directly from MyBatis XML files and JPA entities, making it ideal for air-gapped environments or legacy systems without active DB access.

### How does the impact report help with schema migrations?

The skill identifies all code-level dependencies for a specific table, highlighting exactly which DAO methods or Repositories will break if you modify the schema. This provides a clear 'blast radius' report before you commit to a migration.

### Which AI agents or environments support this skill?

It is compatible with any AI agent or IDE extension that supports Python 3.8 scripts, including Cursor, Windsurf, and custom CLI-based agents. It exports results in JSON format for easy integration into your existing AI workflows.

### Why should I use this instead of just pasting my code into a standard LLM prompt?

While general LLMs lose context when scanning hundreds of files, this skill uses structured regex scanning to maintain a global map of your domain. It accurately links MyBatis statement IDs and JPA relationships that simple prompting often misses.

### What exactly is included in the purchase?

A SKILL.md with usage instructions and three Python scripts (an entry point plus MyBatis and JPA parsers), MIT licensed. Standard library only, nothing else to install. It is free and the same code is open source on GitHub.

### Are there any specific coding patterns or libraries that this tool cannot scan?

The tool is optimized for standard MyBatis XML and Spring Data JPA annotations. It currently has limited support for dynamic QueryDSL logic or complex Criteria API queries, as those require runtime execution rather than static analysis.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
