Why HSQLDialect initialization takes so long in a spring boot project?

Any help with this issue will be highly appreciated!

I wrote a spring boot REST api that connects to a legacy MySQL database with a huge number of tables - 10759. When I start the spring boot project the log stops at a line which indicates that HSQLDialect is initializing. It takes several minutes for the log to resume its work.

Notice the timestamps of log messages to see what I mean. Once again only the logs which indicate the issue:

2020-04-21 19:10:26.489  INFO 10019 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2020-04-21 19:10:26.699  INFO 10019 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
2020-04-21 19:13:06.068  INFO 10019 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]

The legacy DB version:

innodb_version: 5.6.14
protocol_version: 10
version: 5.6.14-1+debphp.org~precise+1
version_comment: (Ubuntu)
version_compile_machine: x86_64
version_compile_os: debian-linux-gnu

Spring framework version

2.2.4

I also tried to force Hibernate to user MySQL5Dialect , by adding the following line to project’s application.properties file:

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

But it keeps switching to HSQLDialect.

I suspect that the big count of tables somehow relates to the issue. I have similar issues while tring to connect to that same database with several MySQL GUI tools like PHPMyAdmin, DBeaver, MySQL Workbench. Some tools fail load the list of tables. Other do load them but in several minutes.

Can you explain why does it take so long to initialize the HSQLDialect and what can I do to fix that problem, please?

i’m facing the same issue here ! did you find out what is causing it ?

This doesn’t mean that the dialect is actually used, just that an instance was initialized. There are some common code paths that use the HSQLDialect for some purposes that can cause these logs to be printed, which isn’t ideal, but that’s how it is right now. The long startup time is just because the schema introspection takes a lot of time. Try updating Hibernate to the latest version and if that doesn’t help, turn off schema validation i.e. set the hibernate.hbm2ddl.auto property to none

The problem disappeared after I’ve turned off the schema validation!

Wow it worked!

Testing was taking al long time (minutes to start), so the following worked for me: changed “validate” to “none”

jpa:
hibernate:
ddl-auto: none

The SpringBoot App started right away in seconds.