Package org.apache.openjpa.jdbc.conf

Examples of org.apache.openjpa.jdbc.conf.JDBCConfiguration


        return super.createEMF(newProps);
    }


    private void validateTableName(OpenJPAEntityManagerFactorySPI emf) {
        JDBCConfiguration conf = (JDBCConfiguration) emf.getConfiguration();
        DBDictionary dict = conf.getDBDictionaryInstance();
        ClassMapping mapping =  (ClassMapping)conf.
            getMetaDataRepositoryInstance().
            getMetaData(EntityVeryLongNames.class,getClass().
                getClassLoader(), true);
        Table table = mapping.getTable();
        assertTrue(table.getName().length() > 0);
        assertTrue(table.getName().length() <= dict.maxTableNameLength);
        validateColumnNames(table, dict);
        mapping =  (ClassMapping)conf.
            getMetaDataRepositoryInstance().
            getMetaData(EntityReservedWords.class,getClass().
                getClassLoader(), true);
        table = mapping.getTable();
        assertTrue(table.getName().length() > 0);
View Full Code Here


        config.putAll(map);
        return (OpenJPAEntityManagerFactorySPI) Persistence.createEntityManagerFactory("test", config);
    }

    void setDictionary() {
        JDBCConfiguration conf = (JDBCConfiguration) getEntityManagerFactory().getConfiguration();
        dict = conf.getDBDictionaryInstance();
        if (dict instanceof DerbyDictionary || dict instanceof HSQLDictionary) {
            dict.requiresCastForComparisons = false;
            dict.requiresCastForMathFunctions = false;
        } else if (dict instanceof OracleDictionary) {
            dict.setJoinSyntax("sql92");
View Full Code Here

        em.close();
    }


    public void testSubquery() {
        JDBCConfiguration conf = (JDBCConfiguration) emf.getConfiguration();
        DBDictionary dict = conf.getDBDictionaryInstance();
       
        EntityManager em = emf.createEntityManager();
        for (int i = 0; i < querys_jpa20.length; i++) {
            String q = querys_jpa20[i];
            System.err.println(">>> JPQL JPA2 :[ " + i + "]" +q);
View Full Code Here

    public Map<String,Object> getProperties() {
        // add platform property
        Map<String,Object> props = super.getProperties();
        String db = "Unknown";
        try {
            JDBCConfiguration conf = (JDBCConfiguration) getConfiguration();
            db = conf.getDBDictionaryInstance().platform;
        } catch (RuntimeException re) {
        }
        props.put("Platform", "OpenJPA JDBC Edition: " + db + " Database");

        return props;
View Full Code Here

        return new JDBCFetchConfigurationImpl(state, jstate);
    }

    public void setContext(StoreContext ctx) {
        super.setContext(ctx);
        JDBCConfiguration conf = getJDBCConfiguration();
        if (conf == null)
            return;

        setEagerFetchMode(conf.getEagerFetchModeConstant());
        setSubclassFetchMode(conf.getSubclassFetchModeConstant());
        setResultSetType(conf.getResultSetTypeConstant());
        setFetchDirection(conf.getFetchDirectionConstant());
        setLRSSize(conf.getLRSSizeConstant());
        setJoinSyntax(conf.getDBDictionaryInstance().joinSyntax);
    }
View Full Code Here

            && mode != EagerFetchModes.EAGER_JOIN
            && mode != EagerFetchModes.EAGER_PARALLEL)
            throw new IllegalArgumentException(_loc.get("bad-fetch-mode", Integer.valueOf(mode)).getMessage());

        if (mode == DEFAULT) {
            JDBCConfiguration conf = getJDBCConfiguration();
            if (conf != null)
                mode = conf.getEagerFetchModeConstant();
        }
        if (mode != DEFAULT)
            _state.eagerMode = mode;
        return this;
    }
View Full Code Here

            && mode != EagerFetchModes.EAGER_JOIN
            && mode != EagerFetchModes.EAGER_PARALLEL)
            throw new IllegalArgumentException(_loc.get("bad-fetch-mode", Integer.valueOf(mode)).getMessage());

        if (mode == DEFAULT) {
            JDBCConfiguration conf = getJDBCConfiguration();
            if (conf != null)
                mode = conf.getSubclassFetchModeConstant();
        }
        if (mode != DEFAULT)
            _state.subclassMode = mode;
        return this;
    }
View Full Code Here

            && type != ResultSet.TYPE_SCROLL_INSENSITIVE
            && type != ResultSet.TYPE_SCROLL_SENSITIVE)
            throw new IllegalArgumentException(_loc.get("bad-resultset-type", Integer.valueOf(type)).getMessage());

        if (type == DEFAULT) {
            JDBCConfiguration conf = getJDBCConfiguration();
            if (conf != null)
                _state.type = conf.getResultSetTypeConstant();
        } else
            _state.type = type;
        return this;
    }
View Full Code Here

            && direction != ResultSet.FETCH_UNKNOWN)
            throw new IllegalArgumentException(_loc.get("bad-fetch-direction", Integer.valueOf(direction))
                .getMessage());

        if (direction == DEFAULT) {
            JDBCConfiguration conf = getJDBCConfiguration();
            if (conf != null)
                _state.direction = conf.getFetchDirectionConstant();
        } else
            _state.direction = direction;
        return this;
    }
View Full Code Here

            && size != LRSSizes.SIZE_LAST
            && size != LRSSizes.SIZE_UNKNOWN)
            throw new IllegalArgumentException(_loc.get("bad-lrs-size", Integer.valueOf(size)).getMessage());

        if (size == DEFAULT) {
            JDBCConfiguration conf = getJDBCConfiguration();
            if (conf != null)
                _state.size = conf.getLRSSizeConstant();
        } else
            _state.size = size;
        return this;
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.jdbc.conf.JDBCConfiguration

Copyright © 2018 www.massapicom. 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.