use of org.hibernate.console.QueryPage in project jbosstools-hibernate by jbosstools.
the class HibernateExtension method executeHQLQuery.
public QueryPage executeHQLQuery(final String hql, final QueryInputModel queryParameters) {
return (QueryPage) execute(new Command() {
public Object execute() {
ISession session = sessionFactory.openSession();
QueryPage qp = new HQLQueryPage(HibernateExtension.this, hql, queryParameters);
qp.setSession(session);
return qp;
}
});
}
use of org.hibernate.console.QueryPage in project jbosstools-hibernate by jbosstools.
the class ConsoleConfigurationTest method testBuildConfiguration.
@Test
public void testBuildConfiguration() {
MockCCListener listener = new MockCCListener();
Assert.assertTrue(consoleCfg.getConsoleConfigurationListeners().length == 1);
consoleCfg.addConsoleConfigurationListener(listener);
consoleCfg.build();
Assert.assertEquals(0, listener.factoryBuilt);
consoleCfg.buildSessionFactory();
Assert.assertEquals(1, listener.factoryBuilt);
try {
consoleCfg.buildSessionFactory();
Assert.fail(TestConsoleMessages.ConsoleConfigurationTest_factory_already_exists);
} catch (HibernateConsoleRuntimeException hcre) {
}
// $NON-NLS-1$
QueryPage qp = consoleCfg.executeHQLQuery("from java.lang.Object");
Assert.assertNotNull(qp);
Assert.assertEquals(1, listener.queryCreated);
consoleCfg.closeSessionFactory();
Assert.assertEquals(1, listener.factoryClosing);
}
use of org.hibernate.console.QueryPage in project jbosstools-hibernate by jbosstools.
the class ConsoleConfigurationTest method testHQLComments.
@Test
public void testHQLComments() {
consoleCfg.build();
consoleCfg.buildSessionFactory();
try {
consoleCfg.buildSessionFactory();
Assert.fail(TestConsoleMessages.ConsoleConfigurationTest_factory_already_exists);
} catch (HibernateConsoleRuntimeException hcre) {
}
// $NON-NLS-1$
QueryPage qp = consoleCfg.executeHQLQuery("from java.lang.Object --this is my comment");
Assert.assertNotNull(qp);
}
use of org.hibernate.console.QueryPage in project jbosstools-hibernate by jbosstools.
the class QueryPageTabView method createPartControl.
public void createPartControl(Composite parent) {
tabs = new CTabFolder(parent, SWT.CLOSE | SWT.BOTTOM);
tabs.setSimple(false);
tabs.setUnselectedCloseVisible(false);
tabs.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
fireSelectionChangedEvent();
}
});
tabs.addCTabFolder2Listener(new CTabFolder2Adapter() {
public void close(CTabFolderEvent event) {
QueryPage qp = (QueryPage) event.item.getData();
KnownConfigurations.getInstance().getQueryPageModel().remove(qp);
}
});
rebuild();
initActions();
provideSelection();
}
use of org.hibernate.console.QueryPage in project jbosstools-hibernate by jbosstools.
the class HibernateExtension method executeCriteriaQuery.
public QueryPage executeCriteriaQuery(final String criteriaCode, final QueryInputModel model) {
return (QueryPage) execute(new Command() {
public Object execute() {
ISession session = sessionFactory.openSession();
QueryPage qp = new JavaPage(HibernateExtension.this, criteriaCode, model);
qp.setSession(session);
return qp;
}
});
}
Aggregations