6.16.4 Specifying the flush mode

You can specify how the query would handle an uncommitted operation executed for an entity object. This is called specifying the flush mode.

You set the flush mode with the setFlushMode method of the javax.persistence.Query interface. With Cosminexus JPA Provider, you can only set AUTO as the value. You cannot specify COMMIT.

In FlushModeType.AUTO
When a query is executed in a transaction, the changes in all the entities existing in the persistence context that affect the query results are applied to the query results.

This setting is applied to a query regardless of the flush mode of the setFlushMode method of the EntityManager interface.