Search in sources :

Example 56 with SchemaExport

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

the class SchemaExportWithIndexAndDefaultSchema method tearDown.

@After
public void tearDown() {
    System.out.println("********* Starting SchemaExport (drop) for TEAR-DOWN *************************");
    new SchemaExport().drop(EnumSet.of(TargetType.DATABASE, TargetType.STDOUT), metadata);
    System.out.println("********* Completed SchemaExport (drop) for TEAR-DOWN *************************");
    StandardServiceRegistryBuilder.destroy(serviceRegistry);
    serviceRegistry = null;
}
Also used : SchemaExport(org.hibernate.tool.hbm2ddl.SchemaExport) After(org.junit.After)

Example 57 with SchemaExport

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

the class SchemaMigrationTargetScriptCreationTest method tearDown.

@After
public void tearDown() {
    ServiceRegistry serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry(Environment.getProperties());
    try {
        MetadataImplementor metadata = (MetadataImplementor) new MetadataSources(serviceRegistry).addAnnotatedClass(TestEntity.class).buildMetadata();
        metadata.validate();
        new SchemaExport().drop(EnumSet.of(TargetType.DATABASE, TargetType.STDOUT), metadata);
    } finally {
        ServiceRegistryBuilder.destroy(serviceRegistry);
    }
}
Also used : MetadataSources(org.hibernate.boot.MetadataSources) MetadataImplementor(org.hibernate.boot.spi.MetadataImplementor) ServiceRegistry(org.hibernate.service.ServiceRegistry) SchemaExport(org.hibernate.tool.hbm2ddl.SchemaExport) After(org.junit.After)

Example 58 with SchemaExport

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

the class SchemaUpdateWithFunctionIndexTest method tearDown.

@After
public void tearDown() {
    dropFunctionIndex();
    dropTable();
    new SchemaExport().drop(EnumSet.of(TargetType.DATABASE, TargetType.STDOUT), metadata);
    StandardServiceRegistryBuilder.destroy(serviceRegistry);
}
Also used : SchemaExport(org.hibernate.tool.hbm2ddl.SchemaExport) After(org.junit.After)

Example 59 with SchemaExport

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

the class SchemaUpdateWithViewsTest method tearDown.

@After
public void tearDown() {
    dropView();
    System.out.println("********* Starting SchemaExport (drop) for TEAR-DOWN *************************");
    new SchemaExport().drop(EnumSet.of(TargetType.STDOUT, TargetType.DATABASE), metadata);
    System.out.println("********* Completed SchemaExport (drop) for TEAR-DOWN *************************");
    StandardServiceRegistryBuilder.destroy(serviceRegistry);
    serviceRegistry = null;
}
Also used : SchemaExport(org.hibernate.tool.hbm2ddl.SchemaExport) After(org.junit.After)

Example 60 with SchemaExport

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

the class SQLServer2008NVarCharTypeTest method createSchemaExport.

private SchemaExport createSchemaExport(Class[] annotatedClasses) {
    final MetadataSources metadataSources = new MetadataSources(ssr);
    for (Class c : annotatedClasses) {
        metadataSources.addAnnotatedClass(c);
    }
    metadata = (MetadataImplementor) metadataSources.buildMetadata();
    metadata.validate();
    SchemaExport schemaExport = new SchemaExport();
    schemaExport.setHaltOnError(true).setFormat(false);
    return schemaExport;
}
Also used : MetadataSources(org.hibernate.boot.MetadataSources) SchemaExport(org.hibernate.tool.hbm2ddl.SchemaExport)

Aggregations

SchemaExport (org.hibernate.tool.hbm2ddl.SchemaExport)90 Test (org.junit.Test)45 MetadataSources (org.hibernate.boot.MetadataSources)42 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)28 ISchemaExport (org.jboss.tools.hibernate.runtime.spi.ISchemaExport)27 MetadataImplementor (org.hibernate.boot.spi.MetadataImplementor)22 TestForIssue (org.hibernate.testing.TestForIssue)13 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)12 Configuration (org.hibernate.cfg.Configuration)12 Connection (java.sql.Connection)10 IConfiguration (org.jboss.tools.hibernate.runtime.spi.IConfiguration)10 After (org.junit.After)10 SchemaUpdate (org.hibernate.tool.hbm2ddl.SchemaUpdate)9 File (java.io.File)8 Before (org.junit.Before)8 HashMap (java.util.HashMap)5 Metadata (org.hibernate.boot.Metadata)5 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)5 SQLException (java.sql.SQLException)4 Entity (javax.persistence.Entity)4