prakash pichaimuthu
prakash pichaimuthu

Reputation: 31

Spring boot hibernate schema validation

I am trying to validate database schema before running any queries using jdbc template. So is there any way to identify schema changes before making any queries in spring programmatically?? Currently I am using spring boot 2 and hibernate 5.

Upvotes: 2

Views: 2218

Answers (1)

Atul Jain
Atul Jain

Reputation: 1085

Add this to the configuration file.

hibernate.hbm2ddl.auto=validate

If the value is validated then hibernate only validates the table structure- whether the table and columns have existed or not. If the table doesn’t exist then hibernate throws an exception.

Validate is the default value for hbm2ddl.auto.

Upvotes: 3

Related Questions