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 package javax.persistence;
18
19 /**
20  * Flush mode setting.
21  *
22  * <p> When queries are executed within a transaction, if
23  * <code>FlushModeType.AUTO</code> is set on the {@link
24  * javax.persistence.Query Query} or {@link javax.persistence.TypedQuery
25  * TypedQuery} object, or if the flush mode setting for the
26  * persistence context is <code>AUTO</code> (the default) and a flush
27  * mode setting has not been specified for the <code>Query</code> or
28  * <code>TypedQuery</code> object, the persistence provider is
29  * responsible for ensuring that all updates to the state of all
30  * entities in the persistence context which could potentially affect
31  * the result of the query are visible to the processing of the
32  * query. The persistence provider implementation may achieve this by
33  * flushing those entities to the database or by some other means. 
34  * <p> If <code>FlushModeType.COMMIT</code> is set, the effect of
35  * updates made to entities in the persistence context upon queries is
36  * unspecified.
37  *
38  * <p> If there is no transaction active or the persistence context is not
39  * joined to the current transaction, the persistence provider must not flush 
40  * to the database.
41  *
42  * @since 1.0
43  */

44 public enum FlushModeType {
45
46     /** Flushing to occur at transaction commit.  The provider may flush
47      *  at other times, but is not required to.
48      */

49    COMMIT,
50
51     /** (Default) Flushing to occur at query execution. */
52    AUTO
53 }
54