001/*
002 * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved.
003 *
004 * This program and the accompanying materials are made available under the
005 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
006 * which accompanies this distribution.  The Eclipse Public License is available
007 * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License
008 * is available at http://www.eclipse.org/org/documents/edl-v10.php.
009 */
010package javax.persistence;
011
012/**
013 * Defines strategies for fetching data from the database.
014 * The <code>EAGER</code> strategy is a requirement on the persistence
015 * provider runtime that data must be eagerly fetched. The
016 * <code>LAZY</code> strategy is a hint to the persistence provider
017 * runtime that data should be fetched lazily when it is
018 * first accessed. The implementation is permitted to eagerly
019 * fetch data for which the <code>LAZY</code> strategy hint has been
020 * specified.
021 * <p>
022 * <pre>
023 *   Example:
024 *   &#064;Basic(fetch=LAZY)
025 *   protected String getName() { return name; }
026 * </pre>
027 *
028 * @see Basic
029 * @see ElementCollection
030 * @see ManyToMany
031 * @see OneToMany
032 * @see ManyToOne
033 * @see OneToOne
034 * @since Java Persistence 1.0
035 */
036public enum FetchType {
037
038  /**
039   * Defines that data can be lazily fetched.
040   */
041  LAZY,
042
043  /**
044   * Defines that data must be eagerly fetched.
045   */
046  EAGER
047}