Class SqlDialectOptionsConfiguration

java.lang.Object
io.micronaut.data.runtime.config.SqlDialectOptionsConfiguration
Direct Known Subclasses:
DataJdbcConfiguration.DialectOptionsConfiguration, DataR2dbcConfiguration.DialectOptionsConfiguration

public class SqlDialectOptionsConfiguration extends Object
Common SQL dialect option configuration shared by JDBC and R2DBC datasource configuration.
Since:
5.2
  • Constructor Details

    • SqlDialectOptionsConfiguration

      public SqlDialectOptionsConfiguration()
  • Method Details

    • getVersion

      public @Nullable String getVersion()
      Returns:
      The target dialect version.
      Since:
      5.2
    • setVersion

      public void setVersion(@Nullable String version)
      Parameters:
      version - The target dialect version.
      Since:
      5.2
    • isDetectVersion

      public boolean isDetectVersion()
      Returns:
      Whether schema generation and validation target the version reported by the database when no version is configured.
      Since:
      5.3
    • setDetectVersion

      public void setDetectVersion(boolean detectVersion)
      Opts in to targeting the version reported by the database for schema generation and validation when no version is configured. Repository SQL is generated at compilation time and is not affected.
      Parameters:
      detectVersion - Whether to detect the database version
      Since:
      5.3
    • resolveVersion

      public @Nullable String resolveVersion(Supplier<@Nullable String> detector)
      Resolves the dialect version for runtime components such as schema generation: the configured version, or the detected one when detection is enabled.
      Parameters:
      detector - Detects the database version, returning null when it is unknown
      Returns:
      The dialect version, or null for none
      Since:
      5.3
    • parseMajorMinor

      public static @Nullable String parseMajorMinor(@Nullable String text)
      Extracts the major.minor version from a database version text, such as Oracle AI Database 26ai Free Release 23.26.3.0.0 - ... Version 23.26.3.0.0 or 23.26.3.0.0.
      Parameters:
      text - The version text reported by the database or driver
      Returns:
      The major.minor version, or null when the text has none
      Since:
      5.3