Package org.hibernate
Enum FlushMode
- java.lang.Object
- java.lang.Enum<FlushMode>
- org.hibernate.FlushMode
- All Implemented Interfaces:
Serializable,Comparable<FlushMode>
public enumFlushModeextendsEnum<FlushMode>
Represents a flushing strategy. The flush process synchronizes database state with session state by detecting state changes and executing SQL statements. A value of this enumeration specifieswhen the flush process occurs.For example,
COMMITspecifies that the session flushes automatically when the transaction is about to commit.
Enum Constant Summary
Enum Constants Enum Constant Description ALWAYSTheSessionis flushed whenEntityTransaction.commit()is called and before every query.AUTOTheSessionis flushed whenEntityTransaction.commit()is called, and is sometimes flushed before query execution in order to ensure that queries never return stale state.COMMITTheSessionis flushed whenEntityTransaction.commit()is called.MANUALTheSessionis only flushed whenSession.flush()is called explicitly.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description staticFlushModefromJpaFlushMode(FlushModeType flushModeType)staticFlushModeinterpretExternalSetting(String externalName)Interprets an external representation of a flush mode.booleanlessThan(FlushMode other)Compare this flush mode to the given flush mode.FlushModeTypetoJpaFlushMode()staticFlushModeTypetoJpaFlushMode(FlushMode flushMode)staticFlushModevalueOf(String name)Returns the enum constant of this type with the specified name.staticFlushMode[]values()Returns an array containing the constants of this enum type, inthe order they are declared.
Enum Constant Detail
MANUAL
public static final FlushMode MANUAL
TheSessionis only flushed whenSession.flush()is called explicitly. This mode is very efficient for read-only transactions.
COMMIT
public static final FlushMode COMMIT
TheSessionis flushed whenEntityTransaction.commit()is called. It is never automatically flushed before query execution.- See Also:
FlushModeType.COMMIT
AUTO
public static final FlushMode AUTO
TheSessionis flushed whenEntityTransaction.commit()is called, and is sometimes flushed before query execution in order to ensure that queries never return stale state. This is the default flush mode.- See Also:
FlushModeType.AUTO
ALWAYS
public static final FlushMode ALWAYS
TheSessionis flushed whenEntityTransaction.commit()is called and before every query. This is usually unnecessary and inefficient.
Method Detail
values
public static FlushMode[] values()
Returns an array containing the constants of this enum type, inthe order they are declared. This method may be used to iterateover the constants as follows:for (FlushMode c : FlushMode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
valueOf
public static FlushMode valueOf(String name)
Returns the enum constant of this type with the specified name.The string must matchexactly an identifier used to declare anenum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
lessThan
public boolean lessThan(FlushMode other)
Compare this flush mode to the given flush mode.- Returns:
trueif this flush mode flushes less often than the given flush mode
interpretExternalSetting
public static FlushMode interpretExternalSetting(String externalName)
Interprets an external representation of a flush mode.- Parameters:
externalName- the name of aFlushMode, or of aFlushModeType- Returns:
- a
FlushMode, or null if the argument was null - Throws:
MappingException- for an unrecognized external representation
fromJpaFlushMode
public static FlushMode fromJpaFlushMode(FlushModeType flushModeType)
toJpaFlushMode
public static FlushModeType toJpaFlushMode(FlushMode flushMode)
toJpaFlushMode
public FlushModeType toJpaFlushMode()