use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_53.
@Test
public final void test_ResultType_53() throws Exception {
// Select Distinct Object(p) from Product p where (p.quantity > (500 + :int1)) AND (p.partNumber IS NULL))
IQuery namedQuery = namedQuery("Product", "product.int1");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of Object(p) should have been found", type);
assertEquals("The wrong type for Object(p) was retrieved", getType(namedQuery, "jpql.query.Product"), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ParameterType_04.
@Test
public final void test_ParameterType_04() 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(":fname");
assertNotNull("The type of :fname should have been found", type);
assertEquals("The wrong type for :fname 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_74.
@Test
public final void test_ResultType_74() throws Exception {
// UPDATE Employee e SET e.manager = ?1 WHERE e.department = ?2
IQuery namedQuery = namedQuery("Employee", "employee.update.positional");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The Object type should have been returned", type);
assertEquals("The wrong type was retrieved", getType(namedQuery, Object.class), type);
}
use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_25.
@Test
public final void test_ResultType_25() throws Exception {
// SELECT 2 / 2.2F FROM Employee e
IQuery namedQuery = namedQuery("Employee", "employee.division1");
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.IQuery in project eclipselink by eclipse-ee4j.
the class AbstractJPQLQueryHelperTest method test_ResultType_20.
@Test
public final void test_ResultType_20() throws Exception {
// select count(c) FROM Customer c JOIN c.aliases a GROUP BY a.alias HAVING a.alias = SUBSTRING(:string1, :int1, :int2)
IQuery namedQuery = namedQuery("Customer", "customer.substring");
AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
IType type = helper.getResultType();
assertNotNull("The type of count(c) should have been found", type);
assertEquals("The wrong type for count(c) was retrieved", getType(namedQuery, Long.class), type);
}
Aggregations