Package st.orm

Class StormConfig

java.lang.Object
st.orm.StormConfig

public final class StormConfig extends Object
Immutable, untyped configuration for the Storm ORM framework.

A StormConfig holds an immutable set of String key-value properties. Property keys use the same names as the corresponding JVM system properties (e.g. storm.update.default_mode). When a requested key is not present in the property map, the lookup falls back to System.getProperty(String), so existing JVM flag users are unaffected.

Usage

Programmatic configuration:


 StormConfig config = StormConfig.of(Map.of(
     StormConfig.UPDATE_DEFAULT_MODE, "FIELD",
     StormConfig.UPDATE_MAX_SHAPES, "10"
 ));
 ORMTemplate orm = ORMTemplate.of(dataSource, config);
 

When no configuration is provided, ORMTemplate.of(dataSource) uses defaults(), which reads exclusively from system properties.

Since:
1.9
  • Field Details

    • UPDATE_DEFAULT_MODE

      public static final String UPDATE_DEFAULT_MODE
      Default update mode for entities without @DynamicUpdate. Values: ENTITY, FIELD, OFF.
      See Also:
    • UPDATE_DIRTY_CHECK

      public static final String UPDATE_DIRTY_CHECK
      Default dirty check strategy. Values: INSTANCE, VALUE.
      See Also:
    • UPDATE_MAX_SHAPES

      public static final String UPDATE_MAX_SHAPES
      Maximum UPDATE shapes before fallback to full-row update.
      See Also:
    • ENTITY_CACHE_RETENTION

      public static final String ENTITY_CACHE_RETENTION
      Cache retention mode. Values: default, light.
      See Also:
    • TEMPLATE_CACHE_SIZE

      public static final String TEMPLATE_CACHE_SIZE
      Maximum number of compiled templates to cache.
      See Also:
    • ANSI_ESCAPING

      public static final String ANSI_ESCAPING
      Whether to use ANSI escaping for identifiers.
      See Also:
    • VALIDATION_RECORD_MODE

      public static final String VALIDATION_RECORD_MODE
      Record validation mode. Values: fail, warn, none.
      See Also:
    • VALIDATION_SCHEMA_MODE

      public static final String VALIDATION_SCHEMA_MODE
      Schema validation mode. Values: none, warn, fail.
      See Also:
    • VALIDATION_STRICT

      public static final String VALIDATION_STRICT
      Whether to treat schema validation warnings as errors.
      See Also:
    • VALIDATION_INTERPOLATION_MODE

      public static final String VALIDATION_INTERPOLATION_MODE
      Interpolation safety mode. Values: warn, fail, none.
      See Also:
    • SQL_LOG_HYDRATION

      public static final String SQL_LOG_HYDRATION
      How a read's SQL log summary row renders the declared hydration shape of its type. Values: off, short, full.
      See Also:
    • SQL_LOG_LINE_WIDTH

      public static final String SQL_LOG_LINE_WIDTH
      Display width SQL log summary rows aim for, such as 120 for narrow viewers or 240 for wide ones; at least 80.
      See Also:
    • SQL_LOG_CALL_SITE_SKIP

      public static final String SQL_LOG_CALL_SITE_SKIP
      Comma-separated package prefixes or source file names skipped in SQL log call-site attribution.
      See Also:
  • Method Details

    • getProperty

      public @Nullable String getProperty(String key)
      Returns the value of the property with the given key.

      If the key is present in the property map, its value is returned. Otherwise, the value of the corresponding JVM system property is returned. If neither is set, null is returned.

      Parameters:
      key - the property key.
      Returns:
      the property value, or null if not set.
    • getProperty

      public String getProperty(String key, String defaultValue)
      Returns the value of the property with the given key, falling back to the specified default.
      Parameters:
      key - the property key.
      defaultValue - the default value to return if the property is not set.
      Returns:
      the property value, or defaultValue if not set.
    • of

      public static StormConfig of(Map<String,String> properties)
      Creates a new StormConfig with the given properties.
      Parameters:
      properties - the configuration properties; must not be null.
      Returns:
      a new immutable configuration.
    • defaults

      public static StormConfig defaults()
      Returns a configuration that reads exclusively from JVM system properties.

      This is the default configuration used when no explicit StormConfig is provided.

      Returns:
      the default configuration; never null.
    • sqlShapingKeys

      public static Set<String> sqlShapingKeys()
      Returns the keys of the properties that affect the shape of generated SQL.

      Two configurations that differ in any of these keys can generate different SQL for the same template, so caches of generated SQL must include the values of these keys in their cache keys. The set is derived from the key declarations in this class.

      Returns:
      the SQL-shaping property keys; never null.
      Since:
      1.14