use of org.eclipse.persistence.jpa.jpql.tools.spi.IType 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);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IType in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_08.
@Test
public final void test_ResultType_08() throws Exception {
// SELECT AVG(p.quantity) FROM Product p
IQuery namedQuery = namedQuery("Product", "product.quantity");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of AVG(p.quantity) should have been found", type);
assertEquals("The wrong type for AVG(p.quantity) was retrieved", getType(namedQuery, Double.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IType in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_04.
@Test
public final void test_ResultType_04() throws Exception {
// SELECT 2 + 2.2F FROM Employee e
IQuery namedQuery = namedQuery("Employee", "employee.addition1");
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_ParameterType_24.
@Test
public final void test_ParameterType_24() 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.getParameterType(":newdate");
assertNotNull("The type of :newdate should have been found", type);
assertEquals("The wrong type for :newdate was retrieved", getType(namedQuery, Date.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IType in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_69.
@Test
public final void test_ResultType_69() throws Exception {
// SELECT SUM(e.salary) FROM Employee e
IQuery namedQuery = namedQuery("Employee", "employee.sum");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of SUM(e.salary) should have been found", type);
assertEquals("The wrong type for SUM(p.quantity) was retrieved", getType(namedQuery, Long.class), type);
}
Aggregations