Package javax.jdo

Examples of javax.jdo.FetchPlan


     * Checks if the given query loads fields
     * assigned to fetchGroup1
     * @param query the query
     */
    private void checkFetchGroup1(Query query) {
        FetchPlan fetchplan = query.getFetchPlan();
        Collection fetchgroups = fetchplan.getGroups();
        assertTrue("FetchPlan should include fetchGroup1 and not fetchGroup2",
                fetchgroups.contains(FETCH_GROUP_1) &&
                !fetchgroups.contains(FETCH_GROUP_2));
        Transaction transaction = query.getPersistenceManager().
            currentTransaction();
View Full Code Here


     * That fetch group loads field number2.
     * Finally, that fetch group is removed from the fetch plan again.
     * @param query the query
     */
    private void checkFetchGroup2(Query query) {
        FetchPlan fetchplan = query.getFetchPlan();
        fetchplan.addGroup(FETCH_GROUP_2);
        Collection fetchgroups = fetchplan.getGroups();
        assertTrue("FetchPlan should include fetchGroup1 and fetchGroup2",
                fetchgroups.contains(FETCH_GROUP_1) &&
                fetchgroups.contains(FETCH_GROUP_2));
        try {
            Transaction transaction = query.getPersistenceManager().
View Full Code Here

        pm.currentTransaction().commit();
    }

    /** */
    protected void setCartFetchGroups() {
        FetchPlan fp = getPM().getFetchPlan();
        fp.setGroups(CART_FETCH_GROUPS);
        fp.setMaxFetchDepth(2);
    }
View Full Code Here

    }

    /** Set the default plus upper left field as the fetch group.
     */
    protected void setDefaultGroup() {
        FetchPlan fp = getPM().getFetchPlan();
        fp.setGroups(defaultGroup);
    }
View Full Code Here

    }

    /** Set the default plus upper left field as the fetch group.
     */
    protected void setUpperLeftGroup() {
        FetchPlan fp = getPM().getFetchPlan();
        fp.setGroups(upperLeftGroup);
    }
View Full Code Here

    }

    /** Set the default plus lower right field as the fetch group.
     */
    protected void setLowerRightGroup() {
        FetchPlan fp = getPM().getFetchPlan();
        fp.setGroups(upperLeftGroup);
    }
View Full Code Here

    }

    /** Set the default plus both fields as the fetch group.
     */
    protected void setBothGroup() {
        FetchPlan fp = getPM().getFetchPlan();
        fp.setGroups(bothGroup);
    }
View Full Code Here

    /** */
    public void testDetachmentOptions() {
        int expectedOptions =
                FetchPlan.DETACH_LOAD_FIELDS +
                FetchPlan.DETACH_UNLOAD_FIELDS;
        FetchPlan fp = getPM().getFetchPlan();
        int initialOptions = fp.getDetachmentOptions();
        if (FetchPlan.DETACH_LOAD_FIELDS != initialOptions) {
            failCompare(
                "testDetachmentOptions(): wrong getDetachmentOptions() " +
                    "after getPersistenceManager().",
                    FetchPlan.DETACH_LOAD_FIELDS, initialOptions);
        }
        fp.setDetachmentOptions(expectedOptions);
        int actualOptions = fp.getDetachmentOptions();
        if (expectedOptions != actualOptions) {
            failCompare(
                "testDetachmentOptions(): wrong getDetachmentOptions() " +
                    "after setDetachmentOptions().",
                    expectedOptions, actualOptions);
View Full Code Here

    }

    /** */
    public void testMaxFetchDepth() {
        int expectedMaxFetchDepth = 12;
        FetchPlan fp = getPM().getFetchPlan();
        fp.setMaxFetchDepth(expectedMaxFetchDepth);
        int actualMaxFetchDepth = fp.getMaxFetchDepth();
        if (expectedMaxFetchDepth != actualMaxFetchDepth) {
            failCompare(
                "testMaxFetchDepth(): wrong getMaxFetchDepth() " +
                    "after setMaxFetchDepth().",
                    expectedMaxFetchDepth, actualMaxFetchDepth);
View Full Code Here

    }

    /** */
    public void testFetchSize() {
        int expectedFetchSize = 12;
        FetchPlan fp = getPM().getFetchPlan();
        fp.setFetchSize(expectedFetchSize);
        int actualFetchSize = fp.getFetchSize();
        if (expectedFetchSize != actualFetchSize) {
            failCompare(
                "testFetchSize(): wrong getFetchSize() " +
                    "after setFetchSize().",
                    expectedFetchSize, actualFetchSize);
View Full Code Here

TOP

Related Classes of javax.jdo.FetchPlan

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.