use of org.hibernate.tool.schema.internal.SchemaCreatorImpl in project hibernate-orm by hibernate.
the class IndexTest method verifyIndexCreated.
private void verifyIndexCreated(String mappingResource, String expectedIndexName) {
final Metadata metadata = new MetadataSources(ssr).addResource(mappingResource).buildMetadata();
final JournalingSchemaToolingTarget target = new JournalingSchemaToolingTarget();
new SchemaCreatorImpl(ssr).doCreation(metadata, false, target);
assertTrue("Expected index [" + expectedIndexName + "] not seen in schema creation output", target.containedText(expectedIndexName));
}
use of org.hibernate.tool.schema.internal.SchemaCreatorImpl in project hibernate-orm by hibernate.
the class TableGeneratorQuotingTest method testTableGeneratorQuoting.
@Test
@TestForIssue(jiraKey = "HHH-7927")
public void testTableGeneratorQuoting() {
final Metadata metadata = new MetadataSources(serviceRegistry).addAnnotatedClass(TestEntity.class).buildMetadata();
final ConnectionProvider connectionProvider = serviceRegistry.getService(ConnectionProvider.class);
final GenerationTarget target = new GenerationTargetToDatabase(new DdlTransactionIsolatorTestingImpl(serviceRegistry, new JdbcEnvironmentInitiator.ConnectionProviderJdbcConnectionAccess(connectionProvider)));
new SchemaCreatorImpl(serviceRegistry).doCreation(metadata, false, target);
try {
new SchemaValidator().validate(metadata);
} catch (HibernateException e) {
fail("The identifier generator table should have validated. " + e.getMessage());
} finally {
new SchemaDropperImpl(serviceRegistry).doDrop(metadata, false, target);
}
}
use of org.hibernate.tool.schema.internal.SchemaCreatorImpl in project hibernate-orm by hibernate.
the class ImplicitCompositeKeyJoinTest method testSchemaCreationSQLCommandIsGeneratedWithTheCorrectColumnSizeValues.
@Test
public void testSchemaCreationSQLCommandIsGeneratedWithTheCorrectColumnSizeValues() throws Exception {
final StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().build();
try {
final org.hibernate.boot.Metadata metadata = new MetadataSources(ssr).addAnnotatedClass(Employee.class).buildMetadata();
boolean createTableEmployeeFound = false;
final List<String> commands = new SchemaCreatorImpl(ssr).generateCreationCommands(metadata, false);
for (String command : commands) {
LOGGER.info(command);
if (command.toLowerCase().contains("create table employee")) {
final String[] columnsDefinition = getColumnsDefinition(command);
for (int i = 0; i < columnsDefinition.length; i++) {
checkColumnSize(columnsDefinition[i]);
}
createTableEmployeeFound = true;
}
}
assertTrue("Expected create table command for Employee entity not found", createTableEmployeeFound);
} finally {
StandardServiceRegistryBuilder.destroy(ssr);
}
}
Aggregations