英文:
generating java entities from MySQL tables
问题
我有3个MySQL表,需要在Java(Eclipse)中生成它们对应的实体类。
有没有简单的方法?
我正在开发一个Spring Boot应用程序。
英文:
I have 3 MySQL tables and i need to generate their corresponding entities in java (eclipse)
is there an easy way ?
im working on a spring boot application
答案1
得分: 1
大多数人会推荐使用jpa(spring data)这是代码优先的方法,但如果你想采用数据库优先的方法,我有一个很好的框架推荐:
如果你有一些空闲时间,可以尝试使用Jooq。
Jooq有一个Maven依赖,可以从你的数据库中创建所有必要的对象:
Jooq可以连接到你的数据库,甚至可以连接到你的Liquibase模式升级,以确保对象始终与数据库处于相同的状态。
我与Jooq没有任何关联,但Lukas Eder(@lukaseder)是一个很棒的人,他总是在Stack Overflow上回答问题,所以你会得到很好的帮助,如果你正在使用reactor,Jooq是完全兼容的(也与JavaRX兼容)。
英文:
While the majority of people will recommend jpa(spring data) this is codeFirst approach, for DB first approach I have a great framework recommendation:
If you have some time on your hand I will go and try Jooq
Jooq has a maven dependency for creating all necessary objects from your db:
Jooq auto code generation from db
codeGen configuration in maven
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
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)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论