Examples of JDBCReadAheadMetaData


Examples of org.jboss.as.cmp.jdbc.metadata.JDBCReadAheadMetaData

            try {
                // try to get the finder method on the home interface
                Method method = homeClass.getMethod(FIND_BY_PK, new Class[]{entity.getPrimaryKeyClass()});

                JDBCQueryMetaData findByPKMD = manager.getMetaData().getQueryMetaDataForMethod(method);
                JDBCReadAheadMetaData readAhead = (findByPKMD == null ?
                        entity.getMetaData().getReadAhead() : findByPKMD.getReadAhead());

                // got it add it to known finders
                JDBCQueryMetaData q = new JDBCAutomaticQueryMetaData(
                        method,
                        readAhead,
                        entity.getMetaData().getQlCompiler(),
                        false
                );
                knownQueries.put(method, factory.createFindByPrimaryKeyQuery(q));

                if (log.isDebugEnabled())
                    log.debug("Added findByPrimaryKey query command for home interface");
            } catch (NoSuchMethodException e) {
                throw new RuntimeException("Home interface does not have a findByPrimaryKey method");
            }
        }

        if (localHomeClass != null) {

            Method method;
            try {
                // try to get the finder method on the local home interface
                method = localHomeClass.getMethod(FIND_BY_PK, new Class[]{entity.getPrimaryKeyClass()});
            } catch (NoSuchMethodException e) {
                throw new RuntimeException("Local home interface does " +
                        "not have the method findByPrimaryKey(" +
                        entity.getPrimaryKeyClass().getName() + ")");
            }

            // got it add it to known finders
            JDBCQueryMetaData findByPKMD = manager.getMetaData().getQueryMetaDataForMethod(method);
            JDBCReadAheadMetaData readAhead = (findByPKMD == null ?
                    entity.getMetaData().getReadAhead() : findByPKMD.getReadAhead());
            JDBCQueryMetaData q = new JDBCAutomaticQueryMetaData(method, readAhead, entity.getMetaData().getQlCompiler(), false);
            knownQueries.put(method, factory.createFindByPrimaryKeyQuery(q));

            if (log.isDebugEnabled())
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCReadAheadMetaData

                    }
                }
            }

            // set all of the preloaded values
            JDBCReadAheadMetaData readAhead = relatedCMRField.getReadAhead();
            for (Iterator iter = resultsMap.keySet().iterator(); iter.hasNext(); ) {
                Object key = iter.next();

                // get the results for this key
                List results = (List) resultsMap.get(key);
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCReadAheadMetaData

        from.append(entity.getQualifiedTableName())
                .append(' ')
                .append(alias);

        // set the preload fields
        JDBCReadAheadMetaData readAhead = q.getReadAhead();
        if (readAhead.isOnFind()) {
            setEagerLoadGroup(readAhead.getEagerLoadGroup());
            if (getEagerLoadMask() != null) {
                SQLUtil.appendColumnNamesClause(entity.getTableFields(), getEagerLoadMask(), alias, select);

                List<LeftJoinCMRNode> onFindCMRList = JDBCAbstractQueryCommand.getLeftJoinCMRNodes(
                        entity, entity.getQualifiedTableName(), readAhead.getLeftJoins(), null);

                if (!onFindCMRList.isEmpty()) {
                    setOnFindCMRList(onFindCMRList);
                    JDBCAbstractQueryCommand.leftJoinCMRNodes(alias, onFindCMRList, aliasManager, from);
                    JDBCAbstractQueryCommand.appendLeftJoinCMRColumnNames(onFindCMRList, aliasManager, select);
                }
            }
        }

        StringBuffer where = new StringBuffer();
        SQLUtil.getWhereClause(entity.getPrimaryKeyFields(), alias, where);

        // generate the sql
        StringBuffer sql = new StringBuffer(300);
        if (rowLocking && readAhead.isOnFind() && getEagerLoadMask() != null) {
            JDBCFunctionMappingMetaData rowLockingTemplate = typeMapping.getRowLockingTemplate();
            rowLockingTemplate.getFunctionSql(
                    new Object[]{
                            select,
                            from,
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCReadAheadMetaData

            if (!entry.readahead.isNone()) {
                listCache.promote(entry.results);
            }

            // get the readahead metadata
            JDBCReadAheadMetaData readahead = entry.readahead;
            if (readahead == null) {
                readahead = manager.getMetaData().getReadAhead();
            }

            int from = entry.index;
            int to = Math.min(entry.results.size(), entry.index + readahead.getPageSize());
            List loadKeys = entry.results.subList(from, to);
            return new EntityReadAheadInfo(loadKeys, readahead);
        } else {
            return new EntityReadAheadInfo(Collections.singletonList(pk));
        }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCReadAheadMetaData

            // set the select entity
            setSelectEntity(selectEntity);

            // set the preload fields
            JDBCReadAheadMetaData readahead = metadata.getReadAhead();
            if (readahead.isOnFind()) {
                setEagerLoadGroup(readahead.getEagerLoadGroup());
                setOnFindCMRList(compiler.getLeftJoinCMRList());

                // exclude non-searchable columns if distinct is used
                if (compiler.isSelectDistinct()) {
                    boolean[] mask = getEagerLoadMask();
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCReadAheadMetaData

            selectFunction = compiler.getSelectFunction();
        }

        boolean[] mask;
        List leftJoinCMRList;
        JDBCReadAheadMetaData readahead = metadata.getReadAhead();
        if (selectEntity != null && readahead.isOnFind()) {
            mask = selectEntity.getLoadGroupMask(readahead.getEagerLoadGroup());
            boolean modifiedMask = false;
            leftJoinCMRList = compiler.getLeftJoinCMRList();

            // exclude non-searchable columns if distinct is used
            if (compiler.isSelectDistinct()) {
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCReadAheadMetaData

        if (cmpField == null) {
            throw CmpMessages.MESSAGES.noFinderForMethod(finderName);
        }

        // set the preload fields
        JDBCReadAheadMetaData readAhead = q.getReadAhead();
        if (readAhead.isOnFind()) {
            setEagerLoadGroup(readAhead.getEagerLoadGroup());
        }

        // generate the sql
        StringBuffer sql = new StringBuffer(300);
        sql.append(SQLUtil.SELECT);
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCReadAheadMetaData

     */
    public JDBCCustomFinderQuery(JDBCStoreManager manager, Method finderMethod) {
        this.finderMethod = finderMethod;
        this.manager = manager;

        JDBCReadAheadMetaData readAheadMetaData = manager.getMetaData().getReadAhead();
        if ((readAheadMetaData != null) && readAheadMetaData.isOnLoad()) {
            this.readAheadCache = manager.getReadAheadCache();
            this.readAheadMetaData = readAheadMetaData;
        } else {
            this.readAheadCache = null;
            this.readAheadMetaData = null;
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCReadAheadMetaData

                    }
                }
            }

            // set all of the preloaded values
            JDBCReadAheadMetaData readAhead = relatedCMRField.getReadAhead();
            for (Iterator iter = resultsMap.keySet().iterator(); iter.hasNext(); ) {
                Object key = iter.next();

                // get the results for this key
                List results = (List) resultsMap.get(key);
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCReadAheadMetaData

            if (!entry.readahead.isNone()) {
                listCache.promote(entry.results);
            }

            // get the readahead metadata
            JDBCReadAheadMetaData readahead = entry.readahead;
            if (readahead == null) {
                readahead = manager.getMetaData().getReadAhead();
            }

            int from = entry.index;
            int to = Math.min(entry.results.size(), entry.index + readahead.getPageSize());
            List loadKeys = entry.results.subList(from, to);
            return new EntityReadAheadInfo(loadKeys, readahead);
        } else {
            return new EntityReadAheadInfo(Collections.singletonList(pk));
        }
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.