use of org.eclipse.persistence.jpa.jpql.tools.spi.IType in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_42.
@Test
public final void test_ResultType_42() throws Exception {
// SELECT MIN(e.salary) FROM Employee e
IQuery namedQuery = namedQuery("Employee", "employee.min");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of MIN(e.salary) should have been found", type);
assertEquals("The wrong type for MIN(e.salary) was retrieved", getType(namedQuery, Long.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IType in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_10.
@Test
public final void test_ResultType_10() throws Exception {
// SELECT CASE WHEN e.name = 'JPQL' THEN e.working
// WHEN 1 + 2 THEN TRUE
// ELSE p.completed
// END
// FROM Employee e, Project p
IQuery namedQuery = namedQuery("Employee", "employee.case2");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of CASE(...) should have been found", type);
assertEquals("The wrong type for CASE(...) was retrieved", getType(namedQuery, Boolean.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IType 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.IType in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ParameterType_20.
@Test
public final void test_ParameterType_20() throws Exception {
String jpqlQuery = "SELECT c From Customer c where c.home.city IN(:city)";
IQuery namedQuery = new JavaQuery(getPersistenceUnit(), jpqlQuery);
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getParameterType(":city");
assertNotNull("The type of :city should have been found", type);
assertEquals("The wrong type for :city was retrieved", getType(namedQuery, String.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IType in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_31.
@Test
public final void test_ResultType_31() throws Exception {
// SELECT INDEX(c) FROM Address a JOIN a.customerList c
IQuery namedQuery = namedQuery("Address", "address.index");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of INDEX(e) should have been found", type);
assertEquals("The wrong type for INDEX(c) was retrieved", getType(namedQuery, Integer.class), type);
}
Aggregations