use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_58.
@Test
public final void test_ResultType_58() throws Exception {
// SELECT DISTINCT p From Product p where p.shelfLife.soldDate NOT BETWEEN :date1 AND :newdate
IQuery namedQuery = namedQuery("Product", "product.date");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of p should have been found", type);
assertEquals("The wrong type for p was retrieved", getType(namedQuery, "jpql.query.Product"), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_63.
@Test
public final void test_ResultType_63() throws Exception {
// SELECT SQRT(o.totalPrice) FROM Order o
IQuery namedQuery = namedQuery("Order", "order.sqrt");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of SQRT(o.totalPrice) should have been found", type);
assertEquals("The wrong type for SQRT(o.totalPrice) was retrieved", getType(namedQuery, Double.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_21.
@Test
public final void test_ResultType_21() throws Exception {
// select count(c) FROM Customer c JOIN c.aliases a GROUP BY a.alias HAVING a.alias = SUBSTRING(:string1, :int1, :int2)
IQuery namedQuery = namedQuery("Customer", "customer.substring");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of count(c) should have been found", type);
assertEquals("The wrong type for count(c) was retrieved", getType(namedQuery, Long.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ParameterType_18.
@Test
public final void test_ParameterType_18() throws Exception {
// UPDATE Employee e SET e.manager = ?1 WHERE e.department = ?2
IQuery namedQuery = namedQuery("Employee", "employee.update.positional");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getParameterType("?1");
assertNotNull("The type of ?1 should have been found", type);
assertEquals("The wrong type for ?1 was retrieved", getType(namedQuery, String.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_60.
@Test
public final void test_ResultType_60() throws Exception {
// SELECT e.name n From Employee e
IQuery namedQuery = namedQuery("Employee", "employee.resultVariable2");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of e.name as n should have been found", type);
assertEquals("The wrong type for e.name as n was retrieved", getType(namedQuery, String.class), type);
}
Aggregations