Package javax.persistence

Examples of javax.persistence.Query.unwrap()


            org.apache.openjpa.kernel.DelegatingQuery.class,
            org.apache.openjpa.kernel.Query.class,
            org.apache.openjpa.kernel.QueryImpl.class
        };
        for (Class<?> c : validCasts) {
            Object unwrapped = query.unwrap(c);
            assertTrue(c.isInstance(unwrapped));
        }
        em.close();
    }
View Full Code Here


        };
        for (Class<?> c : invalidCasts) {
            try {
                em.getTransaction().begin();
                Query query = em.createQuery(QueryLanguages.LANG_SQL,"");
                query.unwrap(c);
                fail("Expected to fail to unwarp with invalid " + c);
            } catch (PersistenceException e) {
                EntityTransaction txn = em.getTransaction();
                assertTrue(txn.getRollbackOnly());
                txn.rollback();
View Full Code Here

            org.apache.openjpa.kernel.DelegatingQuery.class,
            org.apache.openjpa.kernel.Query.class,
            org.apache.openjpa.kernel.QueryImpl.class
        };
        for (Class c : validCasts) {
            Object unwrapped = query.unwrap(c);
            assertTrue(c.isInstance(unwrapped));
        }
        em.close();
    }
View Full Code Here

        };
        for (Class<?> c : invalidCasts) {
            try {
                em.getTransaction().begin();
                Query query = em.createQuery(QueryLanguages.LANG_SQL,"");
                query.unwrap(c);
                fail("Expected to fail to unwarp with invalid " + c);
            } catch (PersistenceException e) {
                EntityTransaction txn = em.getTransaction();
                assertTrue(txn.getRollbackOnly());
                txn.rollback();
View Full Code Here

            org.apache.openjpa.kernel.DelegatingQuery.class,
            org.apache.openjpa.kernel.Query.class,
            org.apache.openjpa.kernel.QueryImpl.class
        };
        for (Class c : validCasts) {
            Object unwrapped = query.unwrap(c);
            assertTrue(c.isInstance(unwrapped));
        }
    }

    /**
 
View Full Code Here

        };
        for (Class<?> c : invalidCasts) {
            try {
                em.getTransaction().begin();
                Query query = em.createQuery(QueryLanguages.LANG_SQL,"");
                query.unwrap(c);
                fail("Expected to fail to unwarp with invalid " + c);
            } catch (PersistenceException e) {
                EntityTransaction txn = em.getTransaction();
                assertTrue(txn.getRollbackOnly());
                txn.rollback();
View Full Code Here

            org.apache.openjpa.kernel.DelegatingQuery.class,
            org.apache.openjpa.kernel.Query.class,
            org.apache.openjpa.kernel.QueryImpl.class
        };
        for (Class c : validCasts) {
            Object unwrapped = query.unwrap(c);
            assertTrue(c.isInstance(unwrapped));
        }
    }

    /**
 
View Full Code Here

    @Test
    public void testQueryWithLazyFetchType() {
       
        Query q = em.createQuery("select o from " + FetchTypeTestEntity.class.getSimpleName() + " o");
        ((QueryNotifier) q.unwrap(org.datanucleus.store.query.Query.class)).addListener("foobar", new QueryListener() {
            @Override
            public void listen(String soqlQuery) {
                assertFalse(soqlQuery.toLowerCase().contains("lazyfetchfield"),
                        "Lazy fetch colums should not be loaded.");
            }
View Full Code Here

    // Test that you can override the fetch type in subclasses
    @Test
    public void testQueryWithFetchTypeOverride() {
       
        Query q = em.createQuery("select o from " + FetchTypeOverrideEntity.class.getSimpleName() + " o");
        ((QueryNotifier) q.unwrap(org.datanucleus.store.query.Query.class)).addListener("foobar", new QueryListener() {
            @Override
            public void listen(String soqlQuery) {
                assertTrue(soqlQuery.toLowerCase().contains("lazyfetchfieldwithoverride__c"),
                        "Lazy fetch colums with Eager overrides should be loaded.");
                assertFalse(soqlQuery.toLowerCase().contains("lazyfetchfield__c"),
View Full Code Here

            org.apache.openjpa.kernel.DelegatingQuery.class,
            org.apache.openjpa.kernel.Query.class,
            org.apache.openjpa.kernel.QueryImpl.class
        };
        for (Class c : validCasts) {
            Object unwrapped = query.unwrap(c);
            assertTrue(c.isInstance(unwrapped));
        }
    }

    /**
 
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.