use of org.eclipse.persistence.jpa.jpql.tools.spi.IType in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_17.
@Test
public final void test_ResultType_17() throws Exception {
// SELECT e.name, d.dname FROM Employee e, Dept d
IQuery namedQuery = namedQuery("Employee", "employee.collection");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of (e.name, d.dname) should have been found", type);
assertEquals("The wrong type for (e.name, d.dname) was retrieved", getType(namedQuery, Object[].class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IType in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_44.
@Test
public final void test_ResultType_44() throws Exception {
// SELECT 2 * 2.2F FROM Employee e
IQuery namedQuery = namedQuery("Employee", "employee.multiplication1");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of 2 * 2.2F should have been found", type);
assertEquals("The wrong type for 2 * 2.2F was retrieved", getType(namedQuery, Float.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IType in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_28.
@Test
public final void test_ResultType_28() throws Exception {
// SELECT e.name / 2 FROM Employee e
IQuery namedQuery = namedQuery("Employee", "employee.division4");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of e.name / 2 should have been found", type);
assertEquals("The wrong type for e.name / 2 was retrieved", getType(namedQuery, Object.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IType in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ParameterType_07.
@Test
public final void test_ParameterType_07() throws Exception {
// select c.firstName FROM Customer c Group By c.firstName HAVING c.firstName = concat(:fname, :lname)
IQuery namedQuery = namedQuery("Customer", "customer.name");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getParameterType(":lname");
assertNotNull("The type of :lname should have been found", type);
assertEquals("The wrong type for :lname 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_26.
@Test
public final void test_ResultType_26() throws Exception {
// SELECT AVG(e.salary) / 2E2 FROM Employee e
IQuery namedQuery = namedQuery("Employee", "employee.division2");
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);
}
Aggregations