JPA/Hibernate: create database schema and import data on first run, update schema on subsequent runs
问题 In my projects I often use JPA/Hibernate stack for database. When defining persistence.xml you have couple options you can set hibernate.hbm2ddl.auto . If set to create tables will be recreated on every application run (persisted data will be lost of course). It is also possible to import initial data by setting db fixture with hibernate.hbm2ddl.import_files . When set to update only tables for new entities will be created (persisted data in existing tables will be preserved). The thing is