Search in sources :

Example 1 with JavaQuery

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

the class DeclarationTest method setUpClass.

@Override
protected void setUpClass() throws Exception {
    super.setUpClass();
    virtualQuery = new JavaQuery(getPersistenceUnit(), null);
}
Also used : JavaQuery(org.eclipse.persistence.jpa.tests.jpql.tools.spi.java.JavaQuery)

Example 2 with JavaQuery

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

the class AbstractJPQLQueryHelperTest method test_ParameterType_20.

@Test
public final void test_ParameterType_20() throws Exception {
    String jpqlQuery = "SELECT c From Customer c where c.home.city IN(:city)";
    IQuery namedQuery = new JavaQuery(getPersistenceUnit(), jpqlQuery);
    AbstractJPQLQueryHelper helper = buildQueryHelper(namedQuery);
    IType type = helper.getParameterType(":city");
    assertNotNull("The type of :city should have been found", type);
    assertEquals("The wrong type for :city was retrieved", getType(namedQuery, String.class), type);
}
Also used : IQuery(org.eclipse.persistence.jpa.jpql.tools.spi.IQuery) AbstractJPQLQueryHelper(org.eclipse.persistence.jpa.jpql.tools.AbstractJPQLQueryHelper) JavaQuery(org.eclipse.persistence.jpa.tests.jpql.tools.spi.java.JavaQuery) IType(org.eclipse.persistence.jpa.jpql.tools.spi.IType) Test(org.junit.Test) JPQLCoreTest(org.eclipse.persistence.jpa.tests.jpql.JPQLCoreTest)

Example 3 with JavaQuery

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

the class JavaORMConfiguration method addQuery.

protected void addQuery(Map<String, IQuery> queries, Node node) {
    NamedNodeMap attributes = node.getAttributes();
    Attr nameNode = (Attr) attributes.getNamedItem("name");
    NodeList children = node.getChildNodes();
    for (int childIndex = children.getLength(); --childIndex >= 0; ) {
        Node child = children.item(childIndex);
        if (child.getNodeName().equals("query")) {
            queries.put(nameNode.getValue(), new JavaQuery(this, child.getTextContent()));
        }
    }
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) JavaQuery(org.eclipse.persistence.jpa.tests.jpql.tools.spi.java.JavaQuery) Attr(org.w3c.dom.Attr)

Example 4 with JavaQuery

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

the class ContentAssistTest method setUpClass.

@Override
protected void setUpClass() throws Exception {
    super.setUpClass();
    virtualQuery = new JavaQuery(getPersistenceUnit(), null);
    bnfAccessor = new JPQLQueryBNFAccessor(getGrammar().getExpressionRegistry());
}
Also used : JPQLQueryBNFAccessor(org.eclipse.persistence.jpa.tests.jpql.parser.JPQLQueryBNFAccessor) JavaQuery(org.eclipse.persistence.jpa.tests.jpql.tools.spi.java.JavaQuery)

Aggregations

JavaQuery (org.eclipse.persistence.jpa.tests.jpql.tools.spi.java.JavaQuery)4 AbstractJPQLQueryHelper (org.eclipse.persistence.jpa.jpql.tools.AbstractJPQLQueryHelper)1 IQuery (org.eclipse.persistence.jpa.jpql.tools.spi.IQuery)1 IType (org.eclipse.persistence.jpa.jpql.tools.spi.IType)1 JPQLCoreTest (org.eclipse.persistence.jpa.tests.jpql.JPQLCoreTest)1 JPQLQueryBNFAccessor (org.eclipse.persistence.jpa.tests.jpql.parser.JPQLQueryBNFAccessor)1 Test (org.junit.Test)1 Attr (org.w3c.dom.Attr)1 NamedNodeMap (org.w3c.dom.NamedNodeMap)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1