MyBatis Generator
Generate MyBatis Mapper, Entity and Interface from table structure
Configuration
Table Structure
Documentation
What is MyBatis Generator?
MyBatis Generator is a tool that automatically generates MyBatis configuration files from database table structures. It can generate XML Mapper files, Java Entity classes, and Mapper interfaces, significantly reducing boilerplate code and improving development efficiency.
How to Use
- 1. Enter table DDL statement or JSON format table structure
- 2. Configure package name, author and other options
- 3. Select database type and whether to use Lombok
- 4. Click "Generate" button
Input Formats
DDL Format
CREATE TABLE users ( id INT PRIMARY KEY AUTO_INCREMENT, username VARCHAR(50) NOT NULL, email VARCHAR(100), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
JSON Format
{
"tableName": "users",
"columns": [
{"name": "id", "type": "INT", "primaryKey": true},
{"name": "username", "type": "VARCHAR", "length": 50},
{"name": "email", "type": "VARCHAR", "length": 100},
{"name": "created_at", "type": "TIMESTAMP"}
]
}
Key Features
- Generate complete XML Mapper files with CRUD operations
- Generate Java Entity classes with getters/setters or Lombok
- Generate Mapper interface with method signatures
- Support Lombok annotations (@Data)
- Support MySQL, PostgreSQL, Oracle, SQL Server
- Automatic naming conversion (underscore to camelCase)
Related Tools
SQL Formatter
Online SQL code beautifier and formatter with support for multiple database dialects
Schema to SQL DDL Generator
Convert CSV/JSON data to SQL DDL CREATE TABLE statements with MySQL, PostgreSQL support and auto data type inference
CSV to SQL Generator
Convert CSV data to SQL CREATE TABLE and INSERT statements for multiple databases
JSON Formatter
Format and validate JSON data for improved readability and debugging
SQL Test Data Generator
Generate random test data INSERT statements from table structure with primary and foreign key support