Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate is slow at startup with Running schema validator

I've been running Spring-Boot with JPA and a Postgres Database. Depending on my network environment the starting phase is blocking for more than 15 sec on :

INFO  o.h.tool.hbm2ddl.SchemaValidator - HHH000229: Running schema validator

The strange thing is that my Database is local. Any idea ?

    spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
    spring.jpa.hibernate.ddl-auto= validate
    spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
    spring.datasource.driverClassName=org.postgresql.Driver
    spring.datasource.url=jdbc:postgresql://localhost:5432/cine
like image 418
Gauthier Peel Avatar asked Dec 07 '16 19:12

Gauthier Peel


1 Answers

The schema validator is just slow. We ended up adding this line to our spring configuration file for our "dev" environment profile (application-dev.properties)

spring.jpa.hibernate.ddl-auto=none

This is a bit risky, since the consistency between the database and JPA entities are not verified. But, we have both Test- and QA environments that would pick up any problems.

This fix did cut my startup process by about 20 seconds.

like image 153
Glenn Bech Avatar answered Sep 28 '22 01:09

Glenn Bech