com.holonplatform.datastore.jdbc.spring

## Annotation Type EnableJdbcDatastore

-     @Target(value=TYPE)
       @Retention(value=RUNTIME)
       @Documented
       @Inherited
       @Import(value=JdbcDatastoreRegistrar.class)
       @EnableDatastoreConfiguration
      public @interface EnableJdbcDatastore

  Annotation to be used on Spring Configuration classes to setup a JDBC `Datastore`.
  Since:
    5.0.0
  See Also:
    `JdbcDatastore`

- - ### Field Summary

    Fields
    Modifier and Type | Fields and Description
    --- | ---
    `static String` | `DEFAULT_DATASTORE_BEAN_NAME` Default `Datastore` registration bean name.

  - ### Optional Element Summary

    Optional Elements
    Modifier and Type | Optional Element and Description
    --- | ---
    `String` | `dataContextId` Optional data context id to use to discriminate Datastores when more than one persistence source is configured, i.e.
    `String` | `dataSourceReference` Configures the name of the `DataSource` bean definition to be used to create the `Datastore` registered using this annotation.
    `IdentifierResolutionStrategy` | `identifierResolutionStrategy` Set the `IdentifierResolutionStrategy` to use to resolve `PropertyBox` identifiers.
    `com.holonplatform.jdbc.DatabasePlatform` | `platform` Set the database platform using the `DatabasePlatform` enumeration.
    `com.holonplatform.spring.PrimaryMode` | `primary` Whether to qualify `Datastore` bean as `primary`, i.e.
    `boolean` | `transactional` Get whether to add `Transactional` behaviour to transactional `Datastore` methods, to automatically create or partecipate in a transaction when methods are invoked.

- - ### Field Detail

    - #### DEFAULT_DATASTORE_BEAN_NAME

          public static final String DEFAULT_DATASTORE_BEAN_NAME

      Default `Datastore` registration bean name.

  - ### Element Detail

    - #### dataContextId

          public abstract String dataContextId

      Optional data context id to use to discriminate Datastores when more than one persistence source is configured, i.e. when multiple DataSources are configured in context.

      The configured data context id will be returned by the `DataContextBound.getDataContextId()` method of the registered `Datastore`.

      When a data context id is specified, the registered Datastore is bound to the `DataSource` with a matching data context id, if available. During registration phase, if the data context id is not null/empty and a `dataSourceReference()` is not specified, an DataSource bean is searched in context using the bean name pattern: `dataSource_[datacontextid]` where `[datacontextid]` is equal to `dataContextId()` attribute.

      Returns:
        Data context id
      Default:
        ""

  - - #### dataSourceReference

          public abstract String dataSourceReference

      Configures the name of the `DataSource` bean definition to be used to create the `Datastore` registered using this annotation. See `dataContextId()` for informations about DataSource bean lookup when a specific name is not configured.
      Returns:
        The name of the `DataSource` bean definition to be used to create the `Datastore`
      Default:
        ""

  - - #### platform

          public abstract com.holonplatform.jdbc.DatabasePlatform platform

      Set the database platform using the `DatabasePlatform` enumeration.

      If specified, can be used by the JDBC datastore to auto-dectect a suitable dialect. When not specified, it will be auto-detected using the JDBC connection URL.

      Returns:
        The database platform, or `DatabasePlatform.NONE` if not specified
      Default:
        com.holonplatform.jdbc.DatabasePlatform.NONE

  - - #### primary

          public abstract com.holonplatform.spring.PrimaryMode primary

      Whether to qualify `Datastore` bean as `primary`, i.e. the preferential bean to be injected in a single-valued dependency when multiple candidates are present.

      When mode is `PrimaryMode.AUTO`, the registred Datastore bean is marked as primary only when the `DataSource` bean to which is bound is registered as primary bean.

      Returns:
        Primary mode, defaults to `PrimaryMode.AUTO`
      Default:
        com.holonplatform.spring.PrimaryMode.AUTO

  - - #### transactional

          public abstract boolean transactional

      Get whether to add `Transactional` behaviour to transactional `Datastore` methods, to automatically create or partecipate in a transaction when methods are invoked. Affected methods are:
      - `Datastore.refresh(com.holonplatform.core.datastore.DataTarget, com.holonplatform.core.property.PropertyBox)`
      - `Datastore#insert(com.holonplatform.core.datastore.DataTarget, com.holonplatform.core.property.PropertyBox, com.holonplatform.core.datastore.Datastore.WriteOption...)`
      - `Datastore#update(com.holonplatform.core.datastore.DataTarget, com.holonplatform.core.property.PropertyBox, com.holonplatform.core.datastore.Datastore.WriteOption...)`
      - `Datastore#save(com.holonplatform.core.datastore.DataTarget, com.holonplatform.core.property.PropertyBox, com.holonplatform.core.datastore.Datastore.WriteOption...)`
      - `Datastore#delete(com.holonplatform.core.datastore.DataTarget, com.holonplatform.core.property.PropertyBox, com.holonplatform.core.datastore.Datastore.WriteOption...)`
      Returns:
        Whether to add `Transactional` behaviour to transactional datastore methods. Defaults to `true`.
      Default:
        true

  - - #### identifierResolutionStrategy

          public abstract IdentifierResolutionStrategy identifierResolutionStrategy

      Set the `IdentifierResolutionStrategy` to use to resolve `PropertyBox` identifiers.
      Returns:
        The `IdentifierResolutionStrategy`
      Default:
        com.holonplatform.datastore.jdbc.config.IdentifierResolutionStrategy.AUTO

Copyright © 2019 The Holon Platform. All rights reserved.