Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hibernate populate database on first run

It is possible to make Hibernate insert Java Objects only one first run of the application?

I don't want to load an inser.sql file, i think that is possible to instantiate all my java objects in a specific java file and only on the first run hibernate populate de DB with that objects. How to do it?

like image 608
pmestima Avatar asked Oct 29 '12 12:10

pmestima


1 Answers

you can achieve this by providing hibernate.hbm2ddl.import_files configuration parameter of hibernate. with this configuration you can specify SQL files to be imported after creation of schema. refer to hibernate docs for more information.

like image 164
Jigar Parekh Avatar answered Sep 28 '22 07:09

Jigar Parekh