use of org.jboss.tools.hibernate.runtime.common.IFacade in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method newReverseEngineeringStrategy.
@Override
public IReverseEngineeringStrategy newReverseEngineeringStrategy(String strategyName, IReverseEngineeringStrategy delegate) {
assert delegate instanceof IFacade;
ReverseEngineeringStrategy delegateTarget = (ReverseEngineeringStrategy) ((IFacade) delegate).getTarget();
Object target = newReverseEngineeringStrategy(strategyName, delegateTarget);
return facadeFactory.createReverseEngineeringStrategy(target);
}
use of org.jboss.tools.hibernate.runtime.common.IFacade in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method newHibernateMappingExporter.
@Override
public IHibernateMappingExporter newHibernateMappingExporter(IConfiguration hcfg, File file) {
assert hcfg instanceof IFacade;
ConfigurationFacadeImpl configuration = (ConfigurationFacadeImpl) hcfg;
Metadata metadata = configuration.getMetadata();
HibernateMappingExporterExtension target = new HibernateMappingExporterExtension(facadeFactory, (Configuration) ((IFacade) hcfg).getTarget(), file);
try {
Field metadataField = AbstractExporter.class.getDeclaredField("metadata");
metadataField.setAccessible(true);
metadataField.set(target, metadata);
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
throw new RuntimeException(e);
}
return facadeFactory.createHibernateMappingExporter(target);
}
use of org.jboss.tools.hibernate.runtime.common.IFacade 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.jboss.tools.hibernate.runtime.common.IFacade in project jbosstools-hibernate by jbosstools.
the class ConfigurationFacadeTest method testBuildSessionFactory.
@Test
public void testBuildSessionFactory() throws Throwable {
ISessionFactory sessionFactoryFacade = configurationFacade.buildSessionFactory();
Assert.assertNotNull(sessionFactoryFacade);
Object sessionFactory = ((IFacade) sessionFactoryFacade).getTarget();
Assert.assertNotNull(sessionFactory);
Assert.assertTrue(sessionFactory instanceof SessionFactory);
}
use of org.jboss.tools.hibernate.runtime.common.IFacade in project jbosstools-hibernate by jbosstools.
the class ServiceImplTest method testNewTable.
@Test
public void testNewTable() {
ITable table = service.newTable("foo");
Assert.assertNotNull(table);
Object target = ((IFacade) table).getTarget();
Assert.assertNotNull(target);
Assert.assertTrue(target instanceof Table);
Assert.assertEquals("foo", ((Table) target).getName());
Assert.assertNotNull(((Table) target).getPrimaryKey());
}
Aggregations