use of org.hibernate.query.Query in project microservices by pwillhan.
the class App method nameParameters.
private static Query nameParameters(Session session) {
Query query = session.createQuery("select t from Transaction t where t.amount > :amount and t.transactionType = 'Withdrawl'");
System.out.println("Please specify an amount:");
Scanner scanner = new Scanner(System.in);
query.setParameter("amount", new BigDecimal(scanner.next()));
return query;
}
use of org.hibernate.query.Query in project jbosstools-hibernate by jbosstools.
the class QueryFacadeTest method beforeEach.
@BeforeEach
public void beforeEach() {
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 beforeEach.
@BeforeEach
public void beforeEach() {
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 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);
assertSame(query, ((IFacade) facade).getTarget());
}
use of org.hibernate.query.Query in project jbosstools-hibernate by jbosstools.
the class QueryFacadeTest method beforeEach.
@BeforeEach
public void beforeEach() {
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