简体   繁体   English

从 MySQL 表生成 java 实体

[英]generating java entities from MySQL tables

I have 3 MySQL tables and i need to generate their corresponding entities in java (eclipse) is there an easy way?我有 3 个 MySQL 表,我需要在 java (eclipse) 中生成它们对应的实体有简单的方法吗? im working on a spring boot application我正在研究 spring 启动应用程序

While the majority of people will recommend jpa(spring data) this is codeFirst approach, for DB first approach I have a great framework recommendation:虽然大多数人会推荐 jpa(spring data) 这是 codeFirst 方法,但对于 DB first 方法,我有一个很好的框架推荐:

If you have some time on your hand I will go and try Jooq如果您有时间,我会 go 并尝试 Jooq

Jooq website Jooq 网站

Jooq has a maven dependency for creating all necessary objects from your db: Jooq 有一个 maven 依赖项,用于从您的数据库创建所有必要的对象:

Jooq auto code generation from db 从 db 生成 Jooq 自动代码

codeGen configuration in maven maven 中的 codeGen 配置

Jooq can connect to your db, and even connect to your liquibase schema upgrades so that the object are always on the same stage with the db Jooq 可以连接到您的数据库,甚至可以连接到您的 liquibase 架构升级,以便 object 始终与数据库处于同一阶段

I don't have any connection to Jooq but Lukas Eder (@lukaseder) is an awsome guy, he always answer questions in stack Overflow, so you are in good hands, also if you are using reactor Jooq is fully compatible(also compatible with JavaRX)我与 Jooq 没有任何联系,但 Lukas Eder (@lukaseder) 是一个很棒的人,他总是在堆栈溢出中回答问题,所以你很好,如果你使用反应堆 Jooq 是完全兼容的(也兼容JavaRX)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM