Search in sources :

Example 11 with SchemaValidator

use of org.hibernate.tool.hbm2ddl.SchemaValidator in project midpoint by Evolveum.

the class SchemaChecker method determineDataStructureCompliance.

private DataStructureCompliance determineDataStructureCompliance() {
    Metadata metadata = MetadataExtractorIntegrator.getMetadata();
    try {
        new SchemaValidator().validate(metadata);
        LOGGER.debug("DB schema is OK.");
        return new DataStructureCompliance(DataStructureCompliance.State.COMPLIANT, null);
    } catch (org.hibernate.tool.schema.spi.SchemaManagementException e) {
        LOGGER.warn("Found a problem with DB schema: {}", e.getMessage());
        LOGGER.debug("Exception", e);
        return new DataStructureCompliance(areSomeTablesPresent(metadata) ? DataStructureCompliance.State.NOT_COMPLIANT : DataStructureCompliance.State.NO_TABLES, e);
    }
}
Also used : RGlobalMetadata(com.evolveum.midpoint.repo.sql.data.common.RGlobalMetadata) Metadata(org.hibernate.boot.Metadata) SchemaValidator(org.hibernate.tool.hbm2ddl.SchemaValidator)

Aggregations

SchemaValidator (org.hibernate.tool.hbm2ddl.SchemaValidator)11 Test (org.junit.Test)10 MetadataSources (org.hibernate.boot.MetadataSources)7 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)6 TestForIssue (org.hibernate.testing.TestForIssue)4 Metadata (org.hibernate.boot.Metadata)2 SchemaUpdate (org.hibernate.tool.hbm2ddl.SchemaUpdate)2 RGlobalMetadata (com.evolveum.midpoint.repo.sql.data.common.RGlobalMetadata)1 HibernateException (org.hibernate.HibernateException)1 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)1 MetadataImplementor (org.hibernate.boot.spi.MetadataImplementor)1 SQLServerDialect (org.hibernate.dialect.SQLServerDialect)1 ConnectionProvider (org.hibernate.engine.jdbc.connections.spi.ConnectionProvider)1 DdlTransactionIsolatorTestingImpl (org.hibernate.test.util.DdlTransactionIsolatorTestingImpl)1 RequiresDialect (org.hibernate.testing.RequiresDialect)1 SchemaExport (org.hibernate.tool.hbm2ddl.SchemaExport)1 SchemaCreatorImpl (org.hibernate.tool.schema.internal.SchemaCreatorImpl)1 SchemaDropperImpl (org.hibernate.tool.schema.internal.SchemaDropperImpl)1 GenerationTarget (org.hibernate.tool.schema.internal.exec.GenerationTarget)1 GenerationTargetToDatabase (org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase)1