Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute differnet import.sql in Hibernate/JPA for each persistence unit?

I have configured two persistence units in my JPA/Hibernate configuration. Now i need to execute different import.sql for each persistence unit. How can I specify which import.sql should be executed for each persistence unit? According Hibernate to documentation, I should place import.sql in classpath. If I do that, import.sql is executed on each persistence unit. I need somehow to specify different import.sql for each persistence unit.

like image 835
Dan Avatar asked Jan 21 '26 13:01

Dan


1 Answers

FWIW, this is possible with Hibernate 3.6.0.Beta1 (see HHH-5337), you can now declare what file(s) to import using the hibernate.hbm2ddl.import_files property:

hibernate.hbm2ddl.import_files /mydbload.sql,/mydbload2.sql

So you could use different values for each persistence unit.

like image 102
Pascal Thivent Avatar answered Jan 24 '26 07:01

Pascal Thivent



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!