Class Configuration.Builder

java.lang.Object
org.neo4j.ogm.config.Configuration.Builder
Enclosing class:
Configuration

public static class Configuration.Builder extends Object
Builder for Configuration class
  • Field Details

  • Constructor Details

    • Builder

      public Builder()
      Creates new Configuration builder Use for Java configuration.
    • Builder

      public Builder(ConfigurationSource configurationSource)
      Creates new Configuration builder
      Parameters:
      configurationSource - source of the configuration, file on classpath or filesystem
  • Method Details

    • copy

      public static Configuration.Builder copy(Configuration.Builder builder)
    • uri

      public Configuration.Builder uri(String uri)
      Set URI of the database. The driver is determined from the URI based on its scheme (http/https for HttpDriver, file for EmbeddedDriver, bolt for BoltDriver).
      Parameters:
      uri - uri of the database
      Returns:
      the changed builder
    • connectionPoolSize

      public Configuration.Builder connectionPoolSize(Integer connectionPoolSize)
      Number of connections to the database. Valid only for http and bolt drivers
      Parameters:
      connectionPoolSize - number of connections to the database
      Returns:
      the changed builder
    • encryptionLevel

      public Configuration.Builder encryptionLevel(String encryptionLevel)
      Required encryption level for the connection to the database. Possible values are REQUIRED, OPTIONAL, DISABLED.
      Parameters:
      encryptionLevel - required encryption level
      Returns:
      the changed builder
    • trustStrategy

      public Configuration.Builder trustStrategy(String trustStrategy)
    • trustCertFile

      public Configuration.Builder trustCertFile(String trustCertFile)
    • connectionLivenessCheckTimeout

      public Configuration.Builder connectionLivenessCheckTimeout(Integer connectionLivenessCheckTimeout)
    • verifyConnection

      public Configuration.Builder verifyConnection(Boolean verifyConnection)
      Whether OGM should verify connection to the database at creation of the Driver Useful for "fail-fast" type of configuration where the database is expected to be running during application start up and the connection to the database is expected to be very stable. If the connection can't be verified ConnectionException will be thrown during creation of SessionFactory. If set to false the driver will be created when first Session is requested from SessionFactory
      Parameters:
      verifyConnection - if the connection to the database should be verified, default is false
      Returns:
      the changed builder
    • autoIndex

      @Deprecated public Configuration.Builder autoIndex(String autoIndex)
      Deprecated.
      The usage of this tool is deprecated. Please use a proper migration tooling, like neo4j-migrations or liquibase with the Neo4j plugin. The build-in auto index manager only supports Neo4j 4.4 and higher.
      Auto index config, for possible values see AutoIndexMode
      Parameters:
      autoIndex - auto index config
      Returns:
      the changed builder
    • generatedIndexesOutputDir

      public Configuration.Builder generatedIndexesOutputDir(String generatedIndexesOutputDir)
    • generatedIndexesOutputFilename

      public Configuration.Builder generatedIndexesOutputFilename(String generatedIndexesOutputFilename)
    • neo4jConfLocation

      public Configuration.Builder neo4jConfLocation(String neo4jConfLocation)
    • withCustomProperty

      public Configuration.Builder withCustomProperty(String name, Object value)
    • useNativeTypes

      public Configuration.Builder useNativeTypes()
      Turns on the support for native types on the transport level. All types supported natively by Neo4j will either be transported "as is" to the database or in a format that will be stored in the native form in the database.
      Turning this on prevents implicit conversions of all java.time.* types, Neo4j spatial datatypes (point()) and potentially others in the future.
      Be aware that turning this on in an application that used the implicit conversion and stored nodes and properties with it, will require a refactoring to the database for all java.time.*-properties stored through Neo4j-OGM: They have been stored traditionally as a string in an ISO-8601 format and need to be converted in the database to their native representation as well.
      Returns:
      the changed builder
      Since:
      3.2
    • strictQuerying

      public Configuration.Builder strictQuerying()
      Turns on strict querying. In strict querying mode, Neo4j-OGM uses all reachable static labels in a class inheritance scenario when querying a domain object, either all, one by id oder all by ids. That is, in strict mode, a node needs to have n:LabelA:LabelB when a domain class has this two labels due to inheritance. In relaxed mode, the label of the concrete class is enough.

      Turning strict mode on can improve query performance, when indexes are defined on labels spotted by parent classes.

      Strict query mode is the default since 4.0.

      Returns:
      the changed builder
      Since:
      3.1.16
    • relaxedQuerying

      public Configuration.Builder relaxedQuerying()
      Turns strict querying off and uses only the single static label of a domain class, even if this class is part of an inheritance hierarchy exposing more than one static label. This may have impact on performance as indexes may not be used. However, turning it off may be necessary to query nodes that have been created outside Neo4j-OGM and are missing some labels.
      Returns:
      the changed builder
      Since:
      3.1.16
    • withBasePackages

      public Configuration.Builder withBasePackages(String... basePackages)
      Configures the builder with a list of base packages to scan.
      Parameters:
      basePackages - The new base backages.
      Returns:
      the changed builder
      Since:
      3.2
    • database

      public Configuration.Builder database(String database)
      Configures the database to use. This is only applicable with the bolt transport connected against a 4.0 database.
      Parameters:
      database - The default database to use, maybe null but not empty. null indicates default database.
      Returns:
      the changed builder
      Since:
      3.2.6
    • databaseSelectionProvider

      public Configuration.Builder databaseSelectionProvider(DatabaseSelectionProvider databaseSelectionProvider)
      Configures the database to use. This is only applicable with the bolt transport connected against a 4.0 database.
      Parameters:
      databaseSelectionProvider - The default database to use, maybe null but not empty. null indicates default database.
      Returns:
      the changed builder
      Since:
      3.2.39
    • userSelectionProvider

      public Configuration.Builder userSelectionProvider(UserSelectionProvider userSelectionProvider)
      Configures the user selection provider to use. This is only applicable with the bolt transport connected against a 4.4 database.
      Parameters:
      userSelectionProvider - The UserSelectionProvider to call before creating a session.
      Returns:
      the changed builder
      Since:
      3.2.39
    • build

      public Configuration build()
    • credentials

      public Configuration.Builder credentials(String username, String password)
      Credentials to use to access the database
      Parameters:
      username - username
      password - password
      Returns:
      the changed builder