Add callback for modifying or inspecting LocalContainerEntityManagerFactoryBean

A callback is added in autoconfig, so that if users inject the EntityManagerFactoryBuilder
into their app and use it to create multiple EntityManagerFactories, they all get the
same deferred DDL behaviour. The deferred DDL can also be disabled by setting
spring.jpa.hibernate.deferDdl=true.

Fixes gh-894
This commit is contained in:
Dave Syer
2014-05-19 10:50:14 +01:00
parent f2e3d94fa1
commit a5543f18b9
8 changed files with 167 additions and 22 deletions

View File

@@ -167,8 +167,9 @@ content into your application; rather pick only the properties that you need.
spring.jpa.show-sql=true
spring.jpa.database-platform=
spring.jpa.database=
spring.jpa.generate-ddl=
spring.jpa.generate-ddl=false # ignored by Hibernate, might be useful for other vendors
spring.jpa.hibernate.naming-strategy= # naming classname
spring.jpa.hibernate.defer-ddl=true # defer processing of DDL until application is running
spring.jpa.hibernate.ddl-auto= # defaults to create-drop for embedded dbs
# FLYWAY ({sc-spring-boot-autoconfigure}/flyway/FlywayProperties.{sc-ext}[FlywayProperties])

View File

@@ -1397,8 +1397,10 @@ following to your `application.properties`.
NOTE: Hibernate's own internal property name for this (if you happen to remember it
better) is `hibernate.hbm2ddl.auto`. You can set it, along with other Hibernate native
properties, using `spring.jpa.properties.*` (the prefix is stripped before adding them
to the entity manager). Also, `spring.jpa.generate-ddl=false` switches off all
DDL generation.
to the entity manager). By default the DDL execution (or validation) is deferred until
the `ApplicationContext` has started. There is also a `spring.jpa.generate-ddl` flag, but
it is not used if Hibernate autoconfig is active because the `ddl-auto`
settings are more fine grained.