use of org.eclipse.persistence.jpa.jpql.tools.AbstractJPQLQueryHelper in project eclipselink by eclipse-ee4j.
the class EclipseLinkJPQLQueryHelperTest method test_ResultType_Func_3.
@Test
public void test_ResultType_Func_3() throws Exception {
// SELECT FUNC('age', e.empId, e.name) FROM Employee e
IQuery namedQuery = namedQuery("Employee", "employee.func3");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of FUNC('toString', e.name) should have been found", type);
assertEquals("The wrong type for FUNC('toString', e.name) was retrieved", getType(namedQuery, Object.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.AbstractJPQLQueryHelper in project eclipselink by eclipse-ee4j.
the class EclipseLinkJPQLQueryHelperTest method test_ResultType_Func_1.
@Test
public void test_ResultType_Func_1() throws Exception {
// SELECT FUNC('toString', e.name) FROM Employee e
IQuery namedQuery = namedQuery("Employee", "employee.func1");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of FUNC('toString', e.name) should have been found", type);
assertEquals("The wrong type for FUNC('toString', e.name) was retrieved", getType(namedQuery, Object.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.AbstractJPQLQueryHelper in project eclipselink by eclipse-ee4j.
the class EclipseLinkJPQLQueryHelperTest method test_ResultType_Func_2.
@Test
public void test_ResultType_Func_2() throws Exception {
// SELECT FUNC('age', e.empId, e.salary) FROM Employee e
IQuery namedQuery = namedQuery("Employee", "employee.func2");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of FUNC('age', e.empId, e.salary) should have been found", type);
assertEquals("The wrong type for FUNC('age', e.empId, e.salary) was retrieved", getType(namedQuery, Object.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.AbstractJPQLQueryHelper in project eclipselink by eclipse-ee4j.
the class EclipseLinkJPQLQueryHelperTest2_4 method test_ParameterType_FromSubquery_1.
@Test
public void test_ParameterType_FromSubquery_1() throws Exception {
// Select e3.salary from Employee e, (Select count(e2), e2.department from Employee e2 group by e2.department) e3 where e3.department = :dept
IQuery namedQuery = namedQuery("Employee", "employee.fromSubquery1");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getParameterType(":dept");
assertNotNull("The type of :dept should have been found", type);
assertEquals("The type for :dept was incorrectly calculated", getType(namedQuery, String.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.AbstractJPQLQueryHelper in project eclipselink by eclipse-ee4j.
the class EclipseLinkJPQLQueryHelperTest2_4 method test_ResultType_FromSubquery_4.
@Test
public void test_ResultType_FromSubquery_4() throws Exception {
// Select e3.result from Employee e, (Select count(e2) + 2.2 as result, e2.department from Employee e2 group by e2.department) e3 where e.department = e3.department
IQuery namedQuery = namedQuery("Employee", "employee.fromSubquery4");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The result type should have been found", type);
assertEquals("The result type was not calculated correctly", getType(namedQuery, Double.class), type);
}
Aggregations