use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.
the class SessionFactoryFacadeTest method testOpenSession.
@Test
public void testOpenSession() {
Configuration configuration = new Configuration();
SessionFactory sessionFactory = configuration.buildSessionFactory(new StandardServiceRegistryBuilder().build());
ISessionFactory sessionFactoryFacade = FACADE_FACTORY.createSessionFactory(sessionFactory);
ISession sessionFacade = sessionFactoryFacade.openSession();
Session session = (Session) ((IFacade) sessionFacade).getTarget();
Assert.assertSame(sessionFactory, session.getSessionFactory());
}
use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.
the class ConfigurationCombo method createControl.
protected Control createControl(Composite parent) {
selectionAdapter = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
editor.setConsoleConfigurationName(comboControl.getText());
}
};
Control control = super.createControl(parent);
listener = new KnownConfigurationsAdapter() {
public void sessionFactoryClosing(ConsoleConfiguration configuration, ISessionFactory closingFactory) {
}
public void sessionFactoryBuilt(ConsoleConfiguration ccfg, ISessionFactory builtFactory) {
}
public void configurationRemoved(ConsoleConfiguration root, boolean forUpdate) {
populateComboBox();
}
public void configurationAdded(ConsoleConfiguration root) {
populateComboBox();
}
};
KnownConfigurations.getInstance().addConsoleConfigurationListener(listener);
return control;
}
use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.
the class NodeFactory method setConsoleConfiguration.
private void setConsoleConfiguration(ConsoleConfiguration c) {
consoleConfiguration = c;
ISessionFactory sf = c.getSessionFactory();
classMetaData = sf.getAllClassMetadata();
collectionMetaData = sf.getAllCollectionMetadata();
classes = new ArrayList<String>();
classes.addAll(classMetaData.keySet());
}
use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory 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.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateSessionFactory.
@Test
public void testCreateSessionFactory() {
SessionFactory sessionFactory = (SessionFactory) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { SessionFactory.class }, new TestInvocationHandler());
ISessionFactory facade = facadeFactory.createSessionFactory(sessionFactory);
Assert.assertSame(sessionFactory, ((IFacade) facade).getTarget());
}
Aggregations