use of org.datanucleus.store.schema.naming.NamingFactory in project tests by datanucleus.
the class JPANamingFactoryTest method testJoinTableName.
public void testJoinTableName() {
JPAEntityManagerFactory jpaEMF = (JPAEntityManagerFactory) emf;
NucleusContext nucCtx = jpaEMF.getNucleusContext();
ClassLoaderResolver clr = nucCtx.getClassLoaderResolver(null);
MetaDataManager mmgr = nucCtx.getMetaDataManager();
AbstractClassMetaData cmd1 = mmgr.getMetaDataForClass(UserGroup.class, clr);
NamingFactory factory = new JPANamingFactory(nucCtx);
factory.setNamingCase(NamingCase.LOWER_CASE);
factory.setMaximumLength(SchemaComponent.TABLE, 128);
String name = factory.getTableName(cmd1.getMetaDataForMember("members"));
assertEquals("Join table name is incorrect", "usergroup_groupmember", name);
}
Aggregations