6

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).

2 Answers 2

3

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.

1
  • thanks, well I might just change that code or implement my own validation process. Jun 21, 2011 at 17:46
3

I just created a custom Configuration class to get all the schema violations together. Posting the gist, could be useful to someone else :)

1
  • 1
    It would be awesome to add this to the hibernate maven plugin... I may try to tackle that when I get some time. I'll update if I do it. Jun 24, 2014 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.