Search code examples
hibernatejpaddlauto-generate

Generate db table from clases with Hibernate


I found many tutorials that explain how to map from database the tables into java classes but not viceversa. Please I would like define my model in clases with JPA+Hibernate and when I build it or deploy the project, this be generated in database. I saw this in a project with Spring Boot. But I would like to do with JPA+Hibernate. If you have some advice, thanks in advance!


Solution

  • you can add <property name="hbm2ddl.auto" value="create"/> on your hibernate configuration file. to create database and table from your entity classes