use of org.hibernate.test.annotations.namingstrategy.LongIdentifierNamingStrategy in project hibernate-orm by hibernate.
the class AbstractCharsetNamingStrategyTest method testWithCustomNamingStrategy.
@Test
public void testWithCustomNamingStrategy() throws Exception {
Metadata metadata = new MetadataSources(serviceRegistry).addAnnotatedClass(Address.class).addAnnotatedClass(Person.class).getMetadataBuilder().applyImplicitNamingStrategy(new LongIdentifierNamingStrategy()).build();
UniqueKey uniqueKey = metadata.getEntityBinding(Address.class.getName()).getTable().getUniqueKeyIterator().next();
assertEquals(expectedUniqueKeyName(), uniqueKey.getName());
org.hibernate.mapping.ForeignKey foreignKey = (org.hibernate.mapping.ForeignKey) metadata.getEntityBinding(Address.class.getName()).getTable().getForeignKeyIterator().next();
assertEquals(expectedForeignKeyName(), foreignKey.getName());
org.hibernate.mapping.Index index = metadata.getEntityBinding(Address.class.getName()).getTable().getIndexIterator().next();
assertEquals(expectedIndexName(), index.getName());
}
Aggregations