Examples of JDBCFetchConfigurationImpl


Examples of org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl

        String hintName = "openjpa.FetchPlan.WriteLockMode";

        EntityManager em = emf.createEntityManager();
        OpenJPAEntityManager oem = (OpenJPAEntityManager)em.getDelegate();
        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
        if(inTransaction)
            em.getTransaction().begin();

        writeLockModeHintTest(fPlan, fConfig, hintName, "none",
View Full Code Here

Examples of org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl

    @SuppressWarnings("deprecation")
    private void similarLockTimeoutHintsTest(OpenJPAEntityManager oem, String winner,
        Object expected, Object... hintNvalues) {
        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.pushFetchPlan();
        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl) fPlan
            .getDelegate();

        for( int i = 0 ; i < hintNvalues.length ; i += 2) {
            fPlan.setHint((String)hintNvalues[i], hintNvalues[i+1]);
        }
        for( int i = 0 ; i < hintNvalues.length ; i += 2) {
            String hintName = (String)hintNvalues[i];
            Object expectedValue = hintNvalues[i+1];
            Object getValue = fPlan.getHint(hintName);
            if (hintName.equals(winner)) {
                assertEquals(expectedValue.getClass(), getValue.getClass());
                assertEquals(expectedValue, getValue);
            }
        }
        assertEquals(expected, fPlan.getLockTimeout());
        assertEquals(expected, fConfig.getLockTimeout());

        oem.popFetchPlan();
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl

    @SuppressWarnings("deprecation")
    private void similarQueryTimeoutHintsTest(OpenJPAEntityManager oem, String winner,
        Object expected, Object... hintNvalues) {
        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.pushFetchPlan();
        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl) fPlan
            .getDelegate();

        for( int i = 0 ; i < hintNvalues.length ; i += 2) {
            fPlan.setHint((String)hintNvalues[i], hintNvalues[i+1]);
        }
        for( int i = 0 ; i < hintNvalues.length ; i += 2) {
            String hintName = (String)hintNvalues[i];
            Object expectedValue = hintNvalues[i+1];
            Object getValue = fPlan.getHint(hintName);
            if (hintName.equals(winner)) {
                assertEquals(expectedValue.getClass(), getValue.getClass());
                assertEquals(expectedValue, getValue);
            }
        }
        assertEquals(expected, fPlan.getQueryTimeout());
        assertEquals(expected, fConfig.getQueryTimeout());

        oem.popFetchPlan();
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl

        LockModeType lockMode, int expectedSupportSQLCount,
        String expectedSupportSQL, int expectedNonSupportSQLCount,
        String expectedNonSupportSQL, int expectedVersionUpdateCount,
        String expectedVersionUpdateSQL) {
        OpenJPAEntityManager oem = (OpenJPAEntityManager) em.getDelegate();
        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
        DBDictionary dict = ((JDBCConfiguration) ((OpenJPAEntityManagerSPI) oem)
            .getConfiguration()).getDBDictionaryInstance();

        em.clear();
        resetSQL();
        int beforeIsolation = fConfig.getIsolation();
        em.find(LockEmployee.class, 1, lockMode);
        if (dict.supportsIsolationForUpdate() &&
            dict instanceof DB2Dictionary) {
            assertEquals(expectedSupportSQLCount, getSQLCount());
            assertAllSQLInOrder(expectedSupportSQL);
        } else {
            assertEquals(expectedNonSupportSQLCount, getSQLCount());
            assertAllSQLInOrder(expectedNonSupportSQL);
        }

        resetSQL();
        em.flush();
        assertEquals(expectedVersionUpdateCount, getSQLCount());
        if (expectedVersionUpdateSQL != null)
            assertAllSQLInOrder(expectedVersionUpdateSQL);

        assertEquals(beforeIsolation, fConfig.getIsolation());
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl

        LockModeType lockMode, int expectedSupportSQLCount,
        String expectedSupportSQL, int expectedNonSupportSQLCount,
        String expectedNonSupportSQL, int expectedVersionUpdateCount,
        String expectedVersionUpdateSQL) {
        OpenJPAEntityManager oem = (OpenJPAEntityManager) em.getDelegate();
        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
        DBDictionary dict = ((JDBCConfiguration) ((OpenJPAEntityManagerSPI) oem)
            .getConfiguration()).getDBDictionaryInstance();

        em.clear();
        LockEmployee employee = em.find(LockEmployee.class, 1);
        resetSQL();
        int beforeIsolation = fConfig.getIsolation();
        em.refresh(employee, lockMode);
        if (dict.supportsIsolationForUpdate() &&
            dict instanceof DB2Dictionary) {
            assertEquals(expectedSupportSQLCount, getSQLCount());
            assertAllSQLInOrder(expectedSupportSQL);
        } else {
            assertEquals(expectedNonSupportSQLCount, getSQLCount());
            assertAllSQLInOrder(expectedNonSupportSQL);
        }

        resetSQL();
        em.flush();
        assertEquals(expectedVersionUpdateCount, getSQLCount());
        if (expectedVersionUpdateSQL != null)
            assertAllSQLInOrder(expectedVersionUpdateSQL);

        assertEquals(beforeIsolation, fConfig.getIsolation());
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl

        LockModeType lockMode, int expectedSupportSQLCount,
        String expectedSupportSQL, int expectedNonSupportSQLCount,
        String expectedNonSupportSQL, int expectedVersionUpdateCount,
        String expectedVersionUpdateSQL) {
        OpenJPAEntityManager oem = (OpenJPAEntityManager) em.getDelegate();
        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
        DBDictionary dict = ((JDBCConfiguration) ((OpenJPAEntityManagerSPI) oem)
            .getConfiguration()).getDBDictionaryInstance();

        em.clear();
        LockEmployee employee = em.find(LockEmployee.class, 1);
        resetSQL();
        int beforeIsolation = fConfig.getIsolation();
        em.lock(employee, lockMode);
        if (dict.supportsIsolationForUpdate() &&
            dict instanceof DB2Dictionary) {
            assertEquals(expectedSupportSQLCount, getSQLCount());
            if (expectedSupportSQL != null)
                assertAllSQLInOrder(expectedSupportSQL);
        } else {
            assertEquals(expectedNonSupportSQLCount, getSQLCount());
            if (expectedNonSupportSQL != null)
                assertAllSQLInOrder(expectedNonSupportSQL);
        }
       
        resetSQL();
        em.flush();
        assertEquals(expectedVersionUpdateCount, getSQLCount());
        if (expectedVersionUpdateSQL != null)
            assertAllSQLInOrder(expectedVersionUpdateSQL);

        assertEquals(beforeIsolation, fConfig.getIsolation());
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl

        else {
            Map<JDBCStoreManager.SelectKey, Object[]> relationFieldUnionCache =
                ((JDBCStoreManager)store).getCacheMapFromQuerySQLCache(
                RelationFieldStrategy.class);
            boolean found = true;
            JDBCFetchConfiguration fetchClone = new JDBCFetchConfigurationImpl();
            fetchClone.copy(fetch);
            JDBCStoreManager.SelectKey selKey =
                new JDBCStoreManager.SelectKey(null, field, fetch);
            Object[] obj = relationFieldUnionCache.get(selKey);
            if (obj != null) {
                union = (Union) obj[0];
View Full Code Here

Examples of org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl

        JDBCStoreManager.SelectKey selKey = null;
        if (!((JDBCStoreManager)store).isQuerySQLCacheOn() || elems.length > 1)
            union = newUnion(sm, store, fetch, elems, resJoins);
        else {
            parmList = new ArrayList();
            JDBCFetchConfiguration fetchClone = new JDBCFetchConfigurationImpl();
            fetchClone.copy(fetch);
          
            // to specify the type so that no cast is needed
            storeCollectionUnionCache = ((JDBCStoreManager)store).
                getCacheMapFromQuerySQLCache(StoreCollectionFieldStrategy.class);
            selKey =
View Full Code Here

Examples of org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl

        else {
            Map<JDBCStoreManager.SelectKey, Object[]> relationFieldUnionCache =
                ((JDBCStoreManager)store).getCacheMapFromQuerySQLCache(
                RelationFieldStrategy.class);
            boolean found = true;
            JDBCFetchConfiguration fetchClone = new JDBCFetchConfigurationImpl();
            fetchClone.copy(fetch);
            JDBCStoreManager.SelectKey selKey =
                new JDBCStoreManager.SelectKey(null, field, fetch);
            Object[] obj = relationFieldUnionCache.get(selKey);
            if (obj != null) {
                union = (Union) obj[0];
View Full Code Here

Examples of org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl

        String hintName = "openjpa.FetchBatchSize";

        EntityManager em = emf.createEntityManager();
        OpenJPAEntityManager oem = (OpenJPAEntityManager)em.getDelegate();
        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();

        fetchBatchSizeHintTest(fPlan, fConfig, hintName, "-1", -1);
        fetchBatchSizeHintTest(fPlan, fConfig, hintName, -1, -1);
        fetchBatchSizeHintTest(fPlan, fConfig, hintName, "100", 100);
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.