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.
相关问题
- JPA one-to-many association to an entity with @Inh
- How to reimport module with ES6 import
- How does the JPA handle partial, non-disjoint inhe
- How does the JPA handle partial, non-disjoint inhe
- Tell hibernate hbm2ddl not create individual table
相关文章
- 这个SpringBoot 2.2.x,怎么判断?
- Hibernate Tutorial - Where to put Mapping File?
- Hibernate doesn't generate cascade
- Setup and Tear Down of Complex Database State With
- Writing CRUDRepository's findBy() method on a
- QueryDSL Window functions
- How to left join unrelated entities?
- JPA configure boolean fields to persist as integer
You could probably do something manual using the org.hibernate.tool.hbm2ddl.SchemaExport class when your application starts up.
In all my projects, i use only one import.sql and next to it i create different other *.sql(eg : H2_import.sql,sqlServer_import.sql) and depending on wich persistence unit to use i copy the content of *.sql and past it into import.sql
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:So you could use different values for each persistence unit.