use of org.hibernate.boot.MetadataSources in project hibernate-orm by hibernate.
the class CollectionPkTest method verifyPkNameUsed.
private void verifyPkNameUsed(String mappingResource, String expectedName) {
final Metadata metadata = new MetadataSources(ssr).addResource(mappingResource).buildMetadata();
final JournalingSchemaToolingTarget target = new JournalingSchemaToolingTarget();
new SchemaCreatorImpl(ssr).doCreation(metadata, false, target);
assertTrue("Expected foreign-key name [" + expectedName + "] not seen in schema creation output", target.containedText(expectedName));
}
use of org.hibernate.boot.MetadataSources in project hibernate-orm by hibernate.
the class DisabledForeignKeyTest method expandedTests.
@Test
@TestForIssue(jiraKey = "HHH-9704")
public void expandedTests() {
StandardServiceRegistryBuilder registryBuilder = new StandardServiceRegistryBuilder();
StandardServiceRegistry standardRegistry = registryBuilder.build();
try {
final MetadataSources sources = new MetadataSources(standardRegistry);
sources.addAnnotatedClass(ManyToManyOwner.class);
sources.addAnnotatedClass(ManyToManyTarget.class);
final MetadataImplementor metadata = (MetadataImplementor) sources.buildMetadata();
metadata.validate();
// export the schema
new SchemaExport().execute(EnumSet.of(TargetType.DATABASE), SchemaExport.Action.BOTH, metadata);
try {
// update the schema
new SchemaUpdate().execute(EnumSet.of(TargetType.DATABASE), metadata);
} finally {
// drop the schema
new SchemaExport().execute(EnumSet.of(TargetType.DATABASE), SchemaExport.Action.DROP, metadata);
}
} finally {
StandardServiceRegistryBuilder.destroy(standardRegistry);
}
}
use of org.hibernate.boot.MetadataSources in project hibernate-orm by hibernate.
the class ExtendsTest method testAllSeparateInOne.
@Test
public void testAllSeparateInOne() {
Metadata metadata = new MetadataSources(serviceRegistry).addResource(getBaseForMappings() + "extendshbm/allseparateinone.hbm.xml").buildMetadata();
assertNotNull(metadata.getEntityBinding("org.hibernate.test.extendshbm.Customer"));
assertNotNull(metadata.getEntityBinding("org.hibernate.test.extendshbm.Person"));
assertNotNull(metadata.getEntityBinding("org.hibernate.test.extendshbm.Employee"));
}
use of org.hibernate.boot.MetadataSources in project hibernate-orm by hibernate.
the class ExtendsTest method testOutOfOrder.
@Test
public void testOutOfOrder() {
Metadata metadata = new MetadataSources(serviceRegistry).addResource(getBaseForMappings() + "extendshbm/Customer.hbm.xml").addResource(getBaseForMappings() + "extendshbm/Person.hbm.xml").addResource(getBaseForMappings() + "extendshbm/Employee.hbm.xml").buildMetadata();
assertNotNull(metadata.getEntityBinding("org.hibernate.test.extendshbm.Customer"));
assertNotNull(metadata.getEntityBinding("org.hibernate.test.extendshbm.Person"));
assertNotNull(metadata.getEntityBinding("org.hibernate.test.extendshbm.Employee"));
}
use of org.hibernate.boot.MetadataSources in project hibernate-orm by hibernate.
the class ExtendsTest method testAllInOne.
@Test
public void testAllInOne() {
Metadata metadata = new MetadataSources(serviceRegistry).addResource(getBaseForMappings() + "extendshbm/allinone.hbm.xml").buildMetadata();
assertNotNull(metadata.getEntityBinding("org.hibernate.test.extendshbm.Customer"));
assertNotNull(metadata.getEntityBinding("org.hibernate.test.extendshbm.Person"));
assertNotNull(metadata.getEntityBinding("org.hibernate.test.extendshbm.Employee"));
}
Aggregations