Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to validate schema with Hibernate (all errors)

I am using Hibernate 3.2.6 with hbm files. When using option hibernate.hbm2ddl.auto=validate, I receive only the first validation error. Is there a way to show all erros in schema?

Example: City.hbm.xml file has a property called 'name'. When I drop that column from table, I get: Missing column: name in nfe.dbo.city So far OK. But, City.hbm.xml file has another property called state. When I drop 'state' column from table, I receieve the same error (Missing column: name in nfe.dbo.city) and would like to receive all erros in schema (not just the first one).

like image 921
Ivan Bosnic Avatar asked Jun 21 '11 14:06

Ivan Bosnic


1 Answers

There is no way to get it to show all errors in the schema because of how the code is written. If you read the code for Configuration.validateSchema() you'll see it throws a HibernateException on the first error found and thus ends the validation process.

like image 195
Stevi Deter Avatar answered Nov 05 '22 15:11

Stevi Deter