java – Hibernate – hibernate. hbm2ddl. auto = validate

I'm interested in hibernate hbm2ddl. Auto = interested in the actual work of verification, I am trying to find comprehensive documents

We recently found that the production system was damaged http://opensource.atlassian.com/projects/hibernate/browse/HHH-3532 Hibernate's name matches the foreign key, not the signature, so it will be recreated for you), and hibernate hbm2ddl. Auto = update is being removed from our next version

I'll be happy to get rid of hibernate hbm2ddl. Auto, and manage our database by ourselves However, not all colleagues share this world view, and some are keen to join hibernate hbm2ddl. auto = validate.

I'm worried that this will encounter the same problem. I'm interested in finding more documents about the actual work of this verification Hibernate community documentation( http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html )It really just refers to these values

Does anyone have any good document pointers, or any real-life experience using validation in production systems?

Solution

In my opinion, the best documentation is the source code you can check to determine what happened The relevant method is org hibernate. tool. hbm2ddl. SchemaValidator#validate().

After a quick look at the code, I don't think schemavalidator verifies foreign keys in the database: it checks the existence of tables, columns and ID generators, but doesn't check foreign keys Tests on the pet database seem to confirm this: removing the FK constraint does not break schema validation (in other words, the validator checks whether the application can run, not reference integrity)

Now, hhh-3532 is marked as fixed. Why not upgrade to a newer version of hibernate, or if changing the version of Hibernate is too heavy, why not apply the patch hhh-3532 yourself?

In a word, I don't use hibernate hbm2ddl. Auto = update updates the production database, I use the change script But I use hibernate hbm2ddl. Auto = verify, I'm happy

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>