Search code examples
mysqlspringhibernatests-springsourcetoolsuitejboss-tools

MySQL Workbench Model to Java Persistence Entity


I am designing a database using MySQL Workbench. I've defined a bunch of tables and set up relationship via foreign keys. I am preparing to forward engineer this model to a database schema. Where do I go from there?

What I am looking to do is take the new database and create the Java entities that will correspond to said tables for use in a SpringBoot application. I have seen a few posts that talk about different methods including Eclipse-based solutions that generate these artefacts, but many of these are older solutions and I'm not sure what the current "hot" tool is. Using Spring Source Tool Suite, I installed JBoss Tools which claims to do this via their Hibernate Tools Reverse Engineering utility, but I can't find any step-by-step documentation on how to proceed.

Since the project is in its infancy, I expect frequent changes to be made to the model and would like to consider a solution that can handle those types of updates as well.


Solution

  • In addition to the utilities listed in the comments, there are a couple of other possibilities I want to mention:

    1. Maven Archetypes - Maven-based templating toolkits that can generate projects according to different configurations
    2. JHipster - Yeoman-based templating toolkit that can generate opinionated best-practice Spring-Boot monolithic or microservice applications.

    Number 2 is currently my go-to solution as it has a very active community and does a lot of "cool stuff".