use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_65.
@Test
public final void test_ResultType_65() throws Exception {
// SELECT AVG(e.salary) - 2E2 FROM Employee e
IQuery namedQuery = namedQuery("Employee", "employee.substraction2");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of AVG(salary) / 2E2 should have been found", type);
assertEquals("The wrong type for AVG(salary) / 2E2 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_49.
@Test
public final void test_ResultType_49() throws Exception {
// SELECT NULLIF(e.name, 'JPQL') FROM Employee e
IQuery namedQuery = namedQuery("Employee", "employee.nullif1");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of NULLIF(e.name, 'JPQL') should have been found", type);
assertEquals("The wrong type for NULLIF(e.name, 'JPQL') 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_ParameterType_09.
@Test
public final void test_ParameterType_09() throws Exception {
// select o from Dept o where o.dname in (:dname1, :dname2, :dname3)
IQuery namedQuery = namedQuery("Dept", "dept.dname");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getParameterType(":dname1");
assertNotNull("The type of :dname1 should have been found", type);
assertEquals("The wrong type for :newdate 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_61.
@Test
public final void test_ResultType_61() throws Exception {
// SELECT e.salary / 1000D n From Employee e
IQuery namedQuery = namedQuery("Employee", "employee.resultVariable3");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of e.salary / 1000D n as n should have been found", type);
assertEquals("The wrong type for e.salary / 1000D n as n 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_ParameterType_02.
@Test
public final void test_ParameterType_02() throws Exception {
// SELECT a.alias FROM Alias AS a WHERE (a.alias IS NULL AND :param1 IS NULL) OR a.alias = :param1
IQuery namedQuery = namedQuery("Alias", "alias.param1");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getParameterType(":param1");
assertNotNull("The type of :param1 should have been found", type);
assertEquals("The wrong type for :param1 was retrieved", getType(namedQuery, String.class), type);
}
Aggregations