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 * Flush mode setting. 014 * <p> 015 * <p> When queries are executed within a transaction, if 016 * <code>FlushModeType.AUTO</code> is set on the {@link 017 * javax.persistence.Query Query} or {@link javax.persistence.TypedQuery 018 * TypedQuery} object, or if the flush mode setting for the 019 * persistence context is <code>AUTO</code> (the default) and a flush 020 * mode setting has not been specified for the <code>Query</code> or 021 * <code>TypedQuery</code> object, the persistence provider is 022 * responsible for ensuring that all updates to the state of all 023 * entities in the persistence context which could potentially affect 024 * the result of the query are visible to the processing of the 025 * query. The persistence provider implementation may achieve this by 026 * flushing those entities to the database or by some other means. 027 * <p> If <code>FlushModeType.COMMIT</code> is set, the effect of 028 * updates made to entities in the persistence context upon queries is 029 * unspecified. 030 * <p> 031 * <p> If there is no transaction active, the persistence provider 032 * must not flush to the database. 033 * 034 * @since Java Persistence 1.0 035 */ 036public enum FlushModeType { 037 038 /** 039 * Flushing to occur at transaction commit. The provider may flush 040 * at other times, but is not required to. 041 */ 042 COMMIT, 043 044 /** 045 * (Default) Flushing to occur at query execution. 046 */ 047 AUTO 048}