use of org.jboss.tools.hibernate.runtime.spi.ISession 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.jboss.tools.hibernate.runtime.spi.ISession in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateSession.
@Test
public void testCreateSession() {
Session session = (Session) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { Session.class }, new TestInvocationHandler());
ISession facade = facadeFactory.createSession(session);
Assert.assertSame(session, ((IFacade) facade).getTarget());
}
use of org.jboss.tools.hibernate.runtime.spi.ISession in project jbosstools-hibernate by jbosstools.
the class ClassMetadataFacadeTest method testGetIdentifier.
@Test
public void testGetIdentifier() {
ClassLoader cl = FACADE_FACTORY.getClassLoader();
final SessionImplementor sessionTarget = (SessionImplementor) Proxy.newProxyInstance(cl, new Class[] { SessionImplementor.class }, new TestInvocationHandler());
ISession session = (ISession) Proxy.newProxyInstance(cl, new Class[] { ISession.class, IFacade.class }, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return sessionTarget;
}
});
Object object = Integer.MAX_VALUE;
Assert.assertSame(object, classMetadata.getIdentifier(object, session));
Assert.assertEquals("getIdentifier", methodName);
Assert.assertArrayEquals(new Object[] { object, sessionTarget }, arguments);
}
use of org.jboss.tools.hibernate.runtime.spi.ISession in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateSession.
@Test
public void testCreateSession() {
Session session = (Session) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { Session.class }, new TestInvocationHandler());
ISession facade = facadeFactory.createSession(session);
Assert.assertSame(session, ((IFacade) facade).getTarget());
}
use of org.jboss.tools.hibernate.runtime.spi.ISession in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateSession.
@Test
public void testCreateSession() {
Session session = (Session) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { Session.class }, new TestInvocationHandler());
ISession facade = facadeFactory.createSession(session);
Assert.assertSame(session, ((IFacade) facade).getTarget());
}
Aggregations