Examples of JpaNativeQuery


Examples of org.apache.cayenne.jpa.JpaNativeQuery

import junit.framework.TestCase;

public class JpaNativeQueryTest extends TestCase {

    public void testSetParameter1() {
        JpaNativeQuery q = new JpaNativeQuery(
                new DataContext(),
                "select a from person where name = $name and id = $id ",
                Object.class);
        assertEquals("Should return same query", q, q.setParameter("name", ""));

        /* TODO: uncomment when supported..
        try {
            q.setParameter("unexisting", "");
            fail("Should throw on unexisting parameter");
View Full Code Here

Examples of org.apache.cayenne.jpa.JpaNativeQuery

        }
        */
    }

    public void testSetParameter2() {
        JpaNativeQuery q = new JpaNativeQuery(
                new DataContext(),
                "select a from person where name = ?1 and id = ?2 and addr = ?123 ",
                Object.class);
        assertEquals("Should return same query", q, q.setParameter(1, ""));
        q.setParameter(2, "");
        q.setParameter(123, "");

        /* TODO: uncomment when supported..
        try {
            q.setParameter(3, "");
            fail("Should throw on unexisting parameter");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.