Does Hibernate create tables in the database automatically

后端 未结 8 1194
庸人自扰
庸人自扰 2020-12-01 07:23

Upon reading this (archived) tutorial, they have not mentioned anything over creating tables in the DB. Does the Hibernate handle it automatically by creating tables and fie

8条回答
  •  长情又很酷
    2020-12-01 08:04

    Yes, Hibernate can be configured by way of the hibernate.hbm2ddl.auto property in the hibernate.cfg.xml file to automatically create tables in your DB in order to store your entities in them if the table doesn't already exist.

    This can be handy during development where a new, in-memory, DB can be used and created a new on every run of the application or during testing.

提交回复
热议问题