1 /*
2 * Copyright (c) 2008, 2019 Oracle and/or its affiliates. All rights reserved.
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v. 2.0 which is available at
6 * http://www.eclipse.org/legal/epl-2.0,
7 * or the Eclipse Distribution License v. 1.0 which is available at
8 * http://www.eclipse.org/org/documents/edl-v10.php.
9 *
10 * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
11 */
12
13 // Contributors:
14 // Linda DeMichiel - 2.1
15 // Linda DeMichiel - 2.0
16
17
18 package javax.persistence;
19
20 /**
21 * Defines strategies for fetching data from the database.
22 * The <code>EAGER</code> strategy is a requirement on the persistence
23 * provider runtime that data must be eagerly fetched. The
24 * <code>LAZY</code> strategy is a hint to the persistence provider
25 * runtime that data should be fetched lazily when it is
26 * first accessed. The implementation is permitted to eagerly
27 * fetch data for which the <code>LAZY</code> strategy hint has been
28 * specified.
29 *
30 * <pre>
31 * Example:
32 * @Basic(fetch=LAZY)
33 * protected String getName() { return name; }
34 * </pre>
35 *
36 * @see Basic
37 * @see ElementCollection
38 * @see ManyToMany
39 * @see OneToMany
40 * @see ManyToOne
41 * @see OneToOne
42 * @since 1.0
43 */
44 public enum FetchType {
45
46 /** Defines that data can be lazily fetched. */
47 LAZY,
48
49 /** Defines that data must be eagerly fetched. */
50 EAGER
51 }
52