Use eclipselink.persistence-context.flush-mode to configure the EntityManager FlushMode to be set as a persistence property and specify when flushing occurs.
Table 5-78 describes this persistence property's values.
Table 5-78 Valid Values for persistence-context.flush-mode
| Value | Description |
|---|---|
|
|
(Default) Flushing occurs at query execution. |
|
|
Flushing occurs at transaction commit. |
The property set in persistence.xml or passed to createEntityManagerFactory affects all EntityManagers created by the factory. To apply the property to specific EntityManagers pass it to createEntityManager method.
Example 5-77 shows how to use this property in the persistence.xml file.
Example 5-77 Using persistence-context.flush-mode in persistence.xml
<property name="eclipselink.persistence-context.flush-mode" value="commit" />
For more information, see:
"Enhancing Performance" in Solutions Guide for Oracle TopLink