Top Description Fields Constructors Methods
org.hibernate

public final Enum FlushMode

extends Enum<FlushMode>
Class Inheritance
Imports
org.hibernate.jpa.internal.util.FlushModeTypeHelper, jakarta.persistence.FlushModeType

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 specifies when the flush process occurs.

For example, COMMIT specifies that the session flushes automatically when the transaction is about to commit.

Author
Gavin King
See Also
Session#setHibernateFlushMode, org.hibernate.query.CommonQueryContract#setHibernateFlushMode

Field Summary

Modifier and TypeField and Description
public static final FlushMode
ALWAYS

The Session is flushed when Transaction#commit() is called and before every query.

public static final FlushMode
AUTO

The Session is flushed when Transaction#commit() is called, and is sometimes flushed before query execution in order to ensure that queries never return stale state.

public static final FlushMode
COMMIT

The Session is flushed when Transaction#commit() is called.

public static final FlushMode
MANUAL

The Session is only flushed when Session#flush() is called explicitly.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static FlushMode
public static FlushMode

Returns:

a FlushMode, or null if the argument was null
interpretExternalSetting
(String
the name of a FlushMode, or of a jakarta.persistence.FlushModeType
externalName
)

Interprets an external representation of a flush mode.

public boolean

Returns:

true if this flush mode flushes less often than the given flush mode
lessThan
(FlushMode other)

Compare this flush mode to the given flush mode.

private int
public static FlushModeType
public FlushModeType
public static FlushMode
public static FlushMode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ALWAYSback to summary
public static final FlushMode ALWAYS

The Session is flushed when Transaction#commit() is called and before every query. This is usually unnecessary and inefficient.

AUTOback to summary
public static final FlushMode AUTO

The Session is flushed when Transaction#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
COMMITback to summary
public static final FlushMode COMMIT

The Session is flushed when Transaction#commit() is called. It is never automatically flushed before query execution.

See Also
FlushModeType#COMMIT
MANUALback to summary
public static final FlushMode MANUAL

The Session is only flushed when Session#flush() is called explicitly. This mode is very efficient for read-only transactions.

Constructor Detail

FlushModeback to summary
private FlushMode()

Method Detail

fromJpaFlushModeback to summary
public static FlushMode fromJpaFlushMode(FlushModeType flushModeType)
interpretExternalSettingback to summary
public static FlushMode interpretExternalSetting(String externalName)

Interprets an external representation of a flush mode.

Parameters
externalName:String

the name of a FlushMode, or of a jakarta.persistence.FlushModeType

Returns:FlushMode

a FlushMode, or null if the argument was null

Exceptions
MappingException:
for an unrecognized external representation
lessThanback to summary
public boolean lessThan(FlushMode other)

Compare this flush mode to the given flush mode.

Returns:boolean

true if this flush mode flushes less often than the given flush mode

levelback to summary
private int level()
toJpaFlushModeback to summary
public static FlushModeType toJpaFlushMode(FlushMode flushMode)
toJpaFlushModeback to summary
public FlushModeType toJpaFlushMode()
valueOfback to summary
public static FlushMode valueOf(String name)
valuesback to summary
public static FlushMode[] values()