Class DataConfiguration
java.lang.Object
io.micronaut.data.runtime.config.DataConfiguration
- All Implemented Interfaces:
DataSettings
@ConfigurationProperties("micronaut.data")
public class DataConfiguration
extends Object
implements DataSettings
General data configuration.
- Since:
- 1.0.0
- Author:
- graemerocher
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConfiguration for pageable. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe configuration property that makes repository save methods use insert operations only.static final StringThe configuration property that makes repository save methods fall back to update when insert detects that an entity with an assigned identity already exists.Fields inherited from interface DataSettings
PREFIX, QUERY_LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanvoidsetSaveAsInsert(boolean saveAsInsert) Sets whether repository save methods should always use insert operations.voidsetSaveAssignedIdFallbackToUpdate(boolean saveAssignedIdFallbackToUpdate) Sets whether repository save methods should fall back to update when an insert detects that an entity with a non-generated identity already exists.
-
Field Details
-
SAVE_AS_INSERT_PROPERTY
The configuration property that makes repository save methods use insert operations only.- See Also:
-
SAVE_ASSIGNED_ID_FALLBACK_TO_UPDATE_PROPERTY
The configuration property that makes repository save methods fall back to update when insert detects that an entity with an assigned identity already exists.- See Also:
-
-
Constructor Details
-
DataConfiguration
public DataConfiguration()
-
-
Method Details
-
isSaveAsInsert
public boolean isSaveAsInsert()- Returns:
- Whether repository save methods should always use insert operations.
-
isSaveAssignedIdFallbackToUpdate
public boolean isSaveAssignedIdFallbackToUpdate()- Returns:
- Whether repository save methods should fall back to update for entities with assigned identities.
-
setSaveAsInsert
public void setSaveAsInsert(boolean saveAsInsert) Sets whether repository save methods should always use insert operations. This restores the Micronaut Data 4 behavior wheresaveandsaveAllalways inserted entities instead of selecting insert or update based on identity state.- Parameters:
saveAsInsert- Whether repository save methods should always use insert operations
-
setSaveAssignedIdFallbackToUpdate
public void setSaveAssignedIdFallbackToUpdate(boolean saveAssignedIdFallbackToUpdate) Sets whether repository save methods should fall back to update when an insert detects that an entity with a non-generated identity already exists.- Parameters:
saveAssignedIdFallbackToUpdate- Whether repository save methods should fall back to update
-