use of org.hibernate.query.Query in project crypto-bot by jnidzwetzki.
the class TestPersistence method before.
/**
* Delete old data from tables
*/
@Before
public void before() {
try (final Session session = sessionFactory.openSession()) {
session.beginTransaction();
for (final String tablename : Arrays.asList("BitfinexOrder", "Trade")) {
@SuppressWarnings("rawtypes") final Query query = session.createQuery("delete from " + tablename);
query.executeUpdate();
}
session.close();
}
}
use of org.hibernate.query.Query in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateQuery.
@Test
public void testCreateQuery() {
Query<?> query = (Query<?>) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { Query.class }, new TestInvocationHandler());
IQuery facade = facadeFactory.createQuery(query);
Assert.assertSame(query, ((IFacade) facade).getTarget());
}
use of org.hibernate.query.Query in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateQuery.
@Test
public void testCreateQuery() {
Query<?> query = (Query<?>) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { Query.class }, new TestInvocationHandler());
IQuery facade = facadeFactory.createQuery(query);
Assert.assertSame(query, ((IFacade) facade).getTarget());
}
use of org.hibernate.query.Query in project jbosstools-hibernate by jbosstools.
the class QueryFacadeTest method setUp.
@Before
public void setUp() {
Query<?> queryProxy = (Query<?>) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Query.class }, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
methodName = method.getName();
arguments = args;
if ("list".equals(method.getName())) {
return LIST;
} else if ("getReturnAliases".equals(method.getName())) {
return RETURN_ALIASES;
} else if ("getReturnTypes".equals(method.getName())) {
return RETURN_TYPES;
} else
return null;
}
});
query = new AbstractQueryFacade(FACADE_FACTORY, queryProxy) {
};
}
use of org.hibernate.query.Query in project jbosstools-hibernate by jbosstools.
the class QueryFacadeTest method setUp.
@Before
public void setUp() {
Query<?> queryProxy = (Query<?>) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Query.class }, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
methodName = method.getName();
arguments = args;
if ("list".equals(method.getName())) {
return LIST;
} else if ("getReturnAliases".equals(method.getName())) {
return RETURN_ALIASES;
} else if ("getReturnTypes".equals(method.getName())) {
return RETURN_TYPES;
} else
return null;
}
});
query = new AbstractQueryFacade(FACADE_FACTORY, queryProxy) {
};
}
Aggregations