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
  • Field Details

    • SAVE_AS_INSERT_PROPERTY

      public static final String 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

      public static final String 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 where save and saveAll always 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