Search in sources :

Example 1 with TwinkleToes

use of org.hibernate.test.annotations.id.sequences.entities.TwinkleToes in project hibernate-orm by hibernate.

the class JoinColumnOverrideTest method testBlownPrecision.

@Test
@TestForIssue(jiraKey = "ANN-748")
public void testBlownPrecision() throws Exception {
    StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().applySetting(AvailableSettings.DIALECT, "SQLServer").build();
    try {
        Metadata metadata = new MetadataSources(ssr).addAnnotatedClass(Bunny.class).addAnnotatedClass(PointyTooth.class).addAnnotatedClass(TwinkleToes.class).buildMetadata();
        boolean foundPointyToothCreate = false;
        boolean foundTwinkleToesCreate = false;
        List<String> commands = new SchemaCreatorImpl(ssr).generateCreationCommands(metadata, false);
        for (String command : commands) {
            log.debug(command);
            if (expectedSqlPointyTooth.equals(command)) {
                foundPointyToothCreate = true;
            } else if (expectedSqlTwinkleToes.equals(command)) {
                foundTwinkleToesCreate = true;
            }
        }
        assertTrue("Expected create table command for PointyTooth entity not found", foundPointyToothCreate);
        assertTrue("Expected create table command for TwinkleToes entity not found", foundTwinkleToesCreate);
    } finally {
        StandardServiceRegistryBuilder.destroy(ssr);
    }
}
Also used : StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) SchemaCreatorImpl(org.hibernate.tool.schema.internal.SchemaCreatorImpl) Metadata(org.hibernate.boot.Metadata) MetadataSources(org.hibernate.boot.MetadataSources) TwinkleToes(org.hibernate.test.annotations.id.sequences.entities.TwinkleToes) Bunny(org.hibernate.test.annotations.id.sequences.entities.Bunny) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry) Test(org.junit.Test) TestForIssue(org.hibernate.testing.TestForIssue)

Aggregations

Metadata (org.hibernate.boot.Metadata)1 MetadataSources (org.hibernate.boot.MetadataSources)1 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)1 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)1 Bunny (org.hibernate.test.annotations.id.sequences.entities.Bunny)1 TwinkleToes (org.hibernate.test.annotations.id.sequences.entities.TwinkleToes)1 TestForIssue (org.hibernate.testing.TestForIssue)1 SchemaCreatorImpl (org.hibernate.tool.schema.internal.SchemaCreatorImpl)1 Test (org.junit.Test)1