I come from php/laravel. Whenever I want to seed the database i only need to run php artisan db:seed
. This will run some php scripts that will insert data into the database.
I want to achieve this same feature using spring/hibernate. I know I can add an import.sql
file to seed the database after schema creation. However, I want to import these fixtures using java and the ORM available so I do not need to maintain an sql.
Is there a way? If not, there should be some configuration to trigger a script that use the ORM entity manager to persist entities in the database after schema creation. The main idea is not to maintain a big sql seeder file over schema revisions.
Thanks!