use of org.hibernate.tool.hbm2ddl.SchemaExport in project hibernate-orm by hibernate.
the class SequenceReadingTest method testSequenceReading.
@Test
public void testSequenceReading() {
StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().applySetting(AvailableSettings.DIALECT, MyExtendedH2Dialect.class).build();
try {
final MetadataImplementor metadata = (MetadataImplementor) new MetadataSources(ssr).addAnnotatedClass(MyEntity.class).buildMetadata();
metadata.validate();
try {
// try to update the schema
new SchemaUpdate().execute(EnumSet.of(TargetType.DATABASE), metadata);
} finally {
try {
// clean up
new SchemaExport().drop(EnumSet.of(TargetType.DATABASE), metadata);
} catch (Exception ignore) {
}
}
} finally {
StandardServiceRegistryBuilder.destroy(ssr);
}
}
use of org.hibernate.tool.hbm2ddl.SchemaExport in project hibernate-orm by hibernate.
the class SchemaExportWithGlobalQuotingEnabledTest method setUp.
@Before
public void setUp() {
serviceRegistry = new StandardServiceRegistryBuilder().applySetting(Environment.GLOBALLY_QUOTED_IDENTIFIERS, "true").build();
metadata = (MetadataImplementor) new MetadataSources(serviceRegistry).addAnnotatedClass(MyEntity.class).addAnnotatedClass(Role.class).buildMetadata();
System.out.println("********* Starting SchemaExport for START-UP *************************");
new SchemaExport().create(EnumSet.of(TargetType.STDOUT, TargetType.DATABASE), metadata);
System.out.println("********* Completed SchemaExport for START-UP *************************");
}
use of org.hibernate.tool.hbm2ddl.SchemaExport in project hibernate-orm by hibernate.
the class SchemaExportWithIndexAndDefaultSchema method setUp.
@Before
public void setUp() {
serviceRegistry = new StandardServiceRegistryBuilder().applySetting(Environment.GLOBALLY_QUOTED_IDENTIFIERS, "true").applySetting(Environment.DEFAULT_SCHEMA, "public").build();
metadata = (MetadataImplementor) new MetadataSources(serviceRegistry).addAnnotatedClass(MyEntity.class).buildMetadata();
System.out.println("********* Starting SchemaExport for START-UP *************************");
new SchemaExport().create(EnumSet.of(TargetType.DATABASE, TargetType.STDOUT), metadata);
System.out.println("********* Completed SchemaExport for START-UP *************************");
}
use of org.hibernate.tool.hbm2ddl.SchemaExport in project hibernate-orm by hibernate.
the class MixedFieldPropertyAnnotationTest method tearDown.
@After
public void tearDown() {
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;
}
use of org.hibernate.tool.hbm2ddl.SchemaExport in project hibernate-orm by hibernate.
the class QuotedTableNameWithForeignKeysSchemaUpdateTest method tearDown.
@After
public void tearDown() {
StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().build();
try {
final MetadataImplementor metadata = (MetadataImplementor) new MetadataSources(ssr).addResource("org/hibernate/test/schemaupdate/UserGroup.hbm.xml").buildMetadata();
new SchemaExport().drop(EnumSet.of(TargetType.STDOUT, TargetType.DATABASE), metadata);
} finally {
StandardServiceRegistryBuilder.destroy(ssr);
}
}
Aggregations