All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration Maven / Gradle / Ivy

There is a newer version: 4.0.1
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.openjpa.jdbc.kernel;

import java.sql.Connection;
import java.sql.ResultSet;
import java.util.Collection;
import java.util.Set;

import org.apache.openjpa.jdbc.meta.ClassMapping;
import org.apache.openjpa.jdbc.sql.JoinSyntaxes;
import org.apache.openjpa.kernel.FetchConfiguration;
import org.apache.openjpa.meta.FieldMetaData;

/**
 * JDBC extensions to OpenJPA's {@link FetchConfiguration}.
 *
 * @author Abe White
 * @since 0.3.0
 */
public interface JDBCFetchConfiguration
    extends FetchConfiguration, EagerFetchModes, LRSSizes, JoinSyntaxes {

    /**
     * Return the eager fetch mode. Defaults to the
     * openjpa.jdbc.EagerFetchMode setting.
     */
    int getEagerFetchMode();

    /**
     * Set the eager fetch mode. Defaults to the
     * openjpa.jdbc.EagerFetchMode setting.
     */
    JDBCFetchConfiguration setEagerFetchMode(int mode);

    /**
     * Return the subclass fetch mode. Defaults to the
     * openjpa.jdbc.SubclassFetchMode setting.
     */
    int getSubclassFetchMode();

    /**
     * Return the effective subclass fetch mode for the given type.
     */
    int getSubclassFetchMode(ClassMapping cls);

    /**
     * Set the subclass fetch mode. Defaults to the
     * openjpa.jdbc.SubclassFetchMode setting.
     */
    JDBCFetchConfiguration setSubclassFetchMode(int mode);

    /**
     * The result set type to use as a constant from {@link ResultSet}.
     * Defaults to the openjpa.jdbc.ResultSetType setting.
     */
    int getResultSetType();

    /**
     * The result set type to use as a constant from {@link ResultSet}.
     * Defaults to the openjpa.jdbc.ResultSetType setting.
     */
    JDBCFetchConfiguration setResultSetType(int type);

    /**
     * The fetch direction to use as a constant from {@link ResultSet}.
     * Defaults to the openjpa.jdbc.FetchDirection setting.
     */
    int getFetchDirection();

    /**
     * The fetch direction to use as a constant from {@link ResultSet}.
     * Defaults to the openjpa.jdbc.FetchDirection setting.
     */
    JDBCFetchConfiguration setFetchDirection(int direction);

    /**
     * The large result set size mode to use.
     * Defaults to the openjpa.jdbc.LRSSize setting.
     */
    int getLRSSize();

    /**
     * The large result set size mode to use.
     * Defaults to the openjpa.jdbc.LRSSize setting.
     */
    JDBCFetchConfiguration setLRSSize(int lrsSize);

    /**
     * The join syntax to use.
     */
    int getJoinSyntax();

    /**
     * The join syntax to use.
     */
    JDBCFetchConfiguration setJoinSyntax(int syntax);

    /**
     * Returns the names of the joins that this component will use
     * when loading objects. Defaults to the empty set.  This set is not
     * thread safe.
     *
     * @since 0.4.0.0
     */
    Set getJoins();

    /**
     * Return true if the given fully-qualified join has been added.
     *
     * @since 0.4.0.0
     */
    boolean hasJoin(String field);

    /**
     * Adds field to the set of fully-qualified field names to
     * eagerly join when loading objects. Each class can have at most
     * one to-many eagerly joined fields.
     *
     * @since 0.4.0.0
     */
    JDBCFetchConfiguration addJoin(String field);

    /**
     * Adds fields to the set of fully-qualified field names to
     * eagerly join when loading objects. Each class can have at most
     * one to-many eagerly joined fields.
     *
     * @since 0.4.0.0
     */
    JDBCFetchConfiguration addJoins(Collection fields);

    /**
     * Removes field to the set of fully-qualified field names to
     * eagerly join when loading objects.
     *
     * @since 0.4.0.0
     */
    JDBCFetchConfiguration removeJoin(String field);

    /**
     * Removes fields from the set of fully-qualified
     * field names to eagerly join when loading objects.
     *
     * @since 0.4.0.0
     */
    JDBCFetchConfiguration removeJoins(Collection fields);

    /**
     * Clears the set of field names to join when loading data.
     *
     * @since 0.4.0.0
     */
    JDBCFetchConfiguration clearJoins();

    /**
     * 

The isolation level for queries issued to the database. This overrides * the persistence-unit-wide openjpa.jdbc.TransactionIsolation * value.

* *

Must be one of {@link Connection#TRANSACTION_NONE}, * {@link Connection#TRANSACTION_READ_UNCOMMITTED}, * {@link Connection#TRANSACTION_READ_COMMITTED}, * {@link Connection#TRANSACTION_REPEATABLE_READ}, * {@link Connection#TRANSACTION_SERIALIZABLE}, * or -1 for the default connection level specified by the context in * which this fetch configuration is being used.

* * @since 0.9.7 */ int getIsolation(); /** *

The isolation level for queries issued to the database. This overrides * the persistence-unit-wide openjpa.jdbc.TransactionIsolation * value.

* *

Must be one of {@link Connection#TRANSACTION_NONE}, * {@link Connection#TRANSACTION_READ_UNCOMMITTED}, * {@link Connection#TRANSACTION_READ_COMMITTED}, * {@link Connection#TRANSACTION_REPEATABLE_READ}, * {@link Connection#TRANSACTION_SERIALIZABLE}, * or -1 for the default connection level specified by the context in * which this fetch configuration is being used.

* * @since 0.9.7 */ JDBCFetchConfiguration setIsolation(int level); /** * Convenience method to cast traversal to store-specific type. */ JDBCFetchConfiguration traverseJDBC(FieldMetaData fm); /** * Returns the names of the inner fetch joins that this component will use * when loading objects. Defaults to the empty set. This set is not * thread safe. * * @since 1.0.3 */ Set getFetchInnerJoins(); /** * Return true if the given fully-qualified inner fetch join has been added. * * @since 1.0.3 */ boolean hasFetchInnerJoin(String field); /** * Adds field to the set of fully-qualified field names to * eagerly join when loading objects. Each class can have at most * one to-many eagerly joined fields. * * @since 1.0.3 */ JDBCFetchConfiguration addFetchInnerJoin(String field); /** * Adds fields to the set of fully-qualified field names to * eagerly join when loading objects. Each class can have at most * one to-many eagerly joined fields. * * @since 1.0.3 */ JDBCFetchConfiguration addFetchInnerJoins(Collection fields); /** * Affirms if foreign key for a relation field will be pre-fetched as part of the owning object irrespective of * whether the field is included in the default fetch group of this fetch configuration.
* By default, foreign key for a relation field is pre-fetched as part of the owning object only if the * field in included in the default fetch group of this fetch configuration. * * @since 2.2.0 */ boolean getIgnoreDfgForFkSelect(); /** * Affirms if foreign key for a relation field will be pre-fetched as part of the owning object irrespective of * whether the field is included in the default fetch group of this fetch configuration.
* By default, foreign key for a relation field is pre-fetched as part of the owning object only if the * field in included in the default fetch group of this fetch configuration. * * @since 2.2.0 */ void setIgnoreDfgForFkSelect(boolean b); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy