Search in sources :

Example 6 with SchemaValidator

use of org.hibernate.tool.hbm2ddl.SchemaValidator in project hibernate-orm by hibernate.

the class ViewValidationTest method testSynonymUsingIndividuallySchemaValidator.

@Test
public void testSynonymUsingIndividuallySchemaValidator() {
    ssr = new StandardServiceRegistryBuilder().applySetting(AvailableSettings.ENABLE_SYNONYMS, "true").applySetting(AvailableSettings.HBM2DDL_JDBC_METADATA_EXTRACTOR_STRATEGY, JdbcMetadaAccessStrategy.INDIVIDUALLY).build();
    try {
        final MetadataSources metadataSources = new MetadataSources(ssr);
        metadataSources.addAnnotatedClass(TestEntityWithSynonym.class);
        metadataSources.addAnnotatedClass(TestEntity.class);
        new SchemaValidator().validate(metadataSources.buildMetadata());
    } finally {
        StandardServiceRegistryBuilder.destroy(ssr);
    }
}
Also used : StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) MetadataSources(org.hibernate.boot.MetadataSources) SchemaValidator(org.hibernate.tool.hbm2ddl.SchemaValidator) Test(org.junit.Test)

Example 7 with SchemaValidator

use of org.hibernate.tool.hbm2ddl.SchemaValidator in project hibernate-orm by hibernate.

the class ViewValidationTest method testSynonymUsingGroupedSchemaValidator.

@Test
public void testSynonymUsingGroupedSchemaValidator() {
    ssr = new StandardServiceRegistryBuilder().applySetting(AvailableSettings.ENABLE_SYNONYMS, "true").applySetting(AvailableSettings.HBM2DDL_JDBC_METADATA_EXTRACTOR_STRATEGY, JdbcMetadaAccessStrategy.GROUPED).build();
    try {
        final MetadataSources metadataSources = new MetadataSources(ssr);
        metadataSources.addAnnotatedClass(TestEntityWithSynonym.class);
        metadataSources.addAnnotatedClass(TestEntity.class);
        new SchemaValidator().validate(metadataSources.buildMetadata());
    } finally {
        StandardServiceRegistryBuilder.destroy(ssr);
    }
}
Also used : StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) MetadataSources(org.hibernate.boot.MetadataSources) SchemaValidator(org.hibernate.tool.hbm2ddl.SchemaValidator) Test(org.junit.Test)

Aggregations

SchemaValidator (org.hibernate.tool.hbm2ddl.SchemaValidator)7 Test (org.junit.Test)7 MetadataSources (org.hibernate.boot.MetadataSources)5 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)4 TestForIssue (org.hibernate.testing.TestForIssue)2 HibernateException (org.hibernate.HibernateException)1 Metadata (org.hibernate.boot.Metadata)1 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)1 MetadataImplementor (org.hibernate.boot.spi.MetadataImplementor)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 SchemaUpdate (org.hibernate.tool.hbm2ddl.SchemaUpdate)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