use of org.hibernate.mapping.PersistentClass in project jbosstools-hibernate by jbosstools.
the class ConfigurationFacadeImpl method initializeClassMappings.
@Override
protected void initializeClassMappings() {
HashMap<String, IPersistentClass> classMappings = new HashMap<String, IPersistentClass>();
Iterator<PersistentClass> origin = getMetadata().getEntityBindings().iterator();
while (origin.hasNext()) {
IPersistentClass pc = getFacadeFactory().createPersistentClass(origin.next());
classMappings.put(pc.getEntityName(), pc);
}
for (IPersistentClass pc : addedClasses) {
classMappings.put(pc.getEntityName(), pc);
}
setClassMappings(classMappings);
}
use of org.hibernate.mapping.PersistentClass in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method newSingleTableSubclass.
@Override
public IPersistentClass newSingleTableSubclass(IPersistentClass persistentClass) {
assert persistentClass instanceof IFacade;
IPersistentClass result = facadeFactory.createPersistentClass(new SingleTableSubclass((PersistentClass) ((IFacade) persistentClass).getTarget(), null));
((AbstractPersistentClassFacade) result).setSuperClass(persistentClass);
return result;
}
use of org.hibernate.mapping.PersistentClass in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreatePersistentClass.
@Test
public void testCreatePersistentClass() {
PersistentClass persistentClass = new RootClass();
IPersistentClass facade = facadeFactory.createPersistentClass(persistentClass);
Assert.assertSame(persistentClass, ((IFacade) facade).getTarget());
}
use of org.hibernate.mapping.PersistentClass in project jbosstools-hibernate by jbosstools.
the class Cfg2HbmToolFacadeTest method testGetPersistentClassTag.
@Test
public void testGetPersistentClassTag() {
PersistentClass target = new RootClass();
IPersistentClass persistentClass = new AbstractPersistentClassFacade(FACADE_FACTORY, target) {
};
Assert.assertEquals("class", cfg2HbmToolFacade.getTag(persistentClass));
}
use of org.hibernate.mapping.PersistentClass in project jbosstools-hibernate by jbosstools.
the class ConfigurationFacadeTest method testAddClass.
@Test
public void testAddClass() {
PersistentClass persistentClass = new RootClass();
persistentClass.setEntityName("Foo");
IPersistentClass persistentClassFacade = FACADE_FACTORY.createPersistentClass(persistentClass);
Assert.assertNull(configuration.getClassMapping("Foo"));
configurationFacade.addClass(persistentClassFacade);
Assert.assertEquals(persistentClass, configuration.getClassMapping("Foo"));
}
Aggregations