Search in sources :

Example 61 with IQuery

use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.

the class EclipseLinkJPQLQueryHelperTest2_5 method namedQuery.

@Override
protected IQuery namedQuery(String entityName, String queryName) throws Exception {
    IEntity entity = entity(entityName);
    IQuery namedQuery = entity.getNamedQuery(queryName);
    assertNotNull("The named query " + queryName + " could not be found on " + entityName, namedQuery);
    return namedQuery;
}
Also used : IQuery(org.eclipse.persistence.jpa.jpql.tools.spi.IQuery) IEntity(org.eclipse.persistence.jpa.jpql.tools.spi.IEntity)

Example 62 with IQuery

use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.

the class ORMEntityJPQLQueryHelperTest method namedQuery.

@Override
protected IQuery namedQuery(String entityName, String queryName) throws Exception {
    IEntity entity = entity(entityName);
    IQuery namedQuery = entity.getNamedQuery(queryName);
    assertNotNull("The named query " + queryName + " could not be found on " + entityName, namedQuery);
    return namedQuery;
}
Also used : IQuery(org.eclipse.persistence.jpa.jpql.tools.spi.IQuery) IEntity(org.eclipse.persistence.jpa.jpql.tools.spi.IEntity)

Example 63 with IQuery

use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.

the class DefaultJPQLQueryHelperTest method namedQuery.

@Override
protected IQuery namedQuery(String entityName, String queryName) throws Exception {
    IEntity entity = entity(entityName);
    IQuery namedQuery = entity.getNamedQuery(queryName);
    assertNotNull("The named query " + queryName + " could not be found on " + entityName, namedQuery);
    return namedQuery;
}
Also used : IQuery(org.eclipse.persistence.jpa.jpql.tools.spi.IQuery) IEntity(org.eclipse.persistence.jpa.jpql.tools.spi.IEntity)

Example 64 with IQuery

use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.

the class AbstractJPQLQueryHelperTest method test_ParameterType_12.

@Test
public final void test_ParameterType_12() throws Exception {
    // SELECT e FROM Employee e WHERE e.department = :dept AND e.salary > :base
    IQuery namedQuery = namedQuery("Employee", "employee.deptBase");
    AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
    IType type = helper.getParameterType(":base");
    assertNotNull("The type of :base should have been found", type);
    assertEquals("The wrong type for :base was retrieved", getType(namedQuery, Long.class), type);
}
Also used : IQuery(org.eclipse.persistence.jpa.jpql.tools.spi.IQuery) AbstractJPQLQueryHelper(org.eclipse.persistence.jpa.jpql.tools.AbstractJPQLQueryHelper) IType(org.eclipse.persistence.jpa.jpql.tools.spi.IType) Test(org.junit.Test) JPQLCoreTest(org.eclipse.persistence.jpa.tests.jpql.JPQLCoreTest)

Example 65 with IQuery

use of org.eclipse.persistence.jpa.jpql.tools.spi.IQuery in project eclipselink by eclipse-ee4j.

the class AbstractJPQLQueryHelperTest method test_ResultType_57.

@Test
public final void test_ResultType_57() throws Exception {
    // SELECT c from Customer c where c.home.city IN :city
    IQuery namedQuery = namedQuery("Customer", "customer.city");
    AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
    IType type = helper.getResultType();
    assertNotNull("The type of c should have been found", type);
    assertEquals("The wrong type for c was retrieved", getType(namedQuery, "jpql.query.Customer"), type);
}
Also used : IQuery(org.eclipse.persistence.jpa.jpql.tools.spi.IQuery) AbstractJPQLQueryHelper(org.eclipse.persistence.jpa.jpql.tools.AbstractJPQLQueryHelper) IType(org.eclipse.persistence.jpa.jpql.tools.spi.IType) Test(org.junit.Test) JPQLCoreTest(org.eclipse.persistence.jpa.tests.jpql.JPQLCoreTest)

Aggregations

IQuery (org.eclipse.persistence.jpa.jpql.tools.spi.IQuery)120 AbstractJPQLQueryHelper (org.eclipse.persistence.jpa.jpql.tools.AbstractJPQLQueryHelper)112 IType (org.eclipse.persistence.jpa.jpql.tools.spi.IType)112 Test (org.junit.Test)112 JPQLCoreTest (org.eclipse.persistence.jpa.tests.jpql.JPQLCoreTest)103 BigInteger (java.math.BigInteger)16 Date (java.util.Date)7 IEntity (org.eclipse.persistence.jpa.jpql.tools.spi.IEntity)6 NamedQueries (jakarta.persistence.NamedQueries)1 NamedQuery (jakarta.persistence.NamedQuery)1 Annotation (java.lang.annotation.Annotation)1 BigDecimal (java.math.BigDecimal)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Vector (java.util.Vector)1 JavaQuery (org.eclipse.persistence.jpa.tests.jpql.tools.spi.java.JavaQuery)1