Package org.neo4j.ogm.config
Class Configuration.Builder
java.lang.Object
org.neo4j.ogm.config.Configuration.Builder
- Enclosing class:
- Configuration
Builder for
Configuration class-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
ConstructorsConstructorDescriptionBuilder()Creates new Configuration builder Use for Java configuration.Builder(ConfigurationSource configurationSource) Creates new Configuration builder -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.The usage of this tool is deprecated.build()connectionLivenessCheckTimeout(Integer connectionLivenessCheckTimeout) connectionPoolSize(Integer connectionPoolSize) Number of connections to the database.static Configuration.Buildercopy(Configuration.Builder builder) credentials(String username, String password) Credentials to use to access the databaseConfigures the database to use.databaseSelectionProvider(DatabaseSelectionProvider databaseSelectionProvider) Configures the database to use.encryptionLevel(String encryptionLevel) Required encryption level for the connection to the database.generatedIndexesOutputDir(String generatedIndexesOutputDir) generatedIndexesOutputFilename(String generatedIndexesOutputFilename) neo4jConfLocation(String neo4jConfLocation) 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.Turns on strict querying.trustCertFile(String trustCertFile) trustStrategy(String trustStrategy) Set URI of the database.Turns on the support for native types on the transport level.userSelectionProvider(UserSelectionProvider userSelectionProvider) Configures the user selection provider to use.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.withBasePackages(String... basePackages) Configures the builder with a list of base packages to scan.withCustomProperty(String name, Object value)
-
Field Details
-
databaseSelectionProvider
-
userSelectionProvider
-
-
Constructor Details
-
Builder
public Builder()Creates new Configuration builder Use for Java configuration. -
Builder
Creates new Configuration builder- Parameters:
configurationSource- source of the configuration, file on classpath or filesystem
-
-
Method Details
-
copy
-
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
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
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
-
trustCertFile
-
connectionLivenessCheckTimeout
-
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 verifiedConnectionExceptionwill 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.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 seeAutoIndexMode- Parameters:
autoIndex- auto index config- Returns:
- the changed builder
-
generatedIndexesOutputDir
-
generatedIndexesOutputFilename
-
neo4jConfLocation
-
withCustomProperty
-
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 alljava.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 alljava.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
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 haven:LabelA:LabelBwhen 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
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
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
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
Configures the user selection provider to use. This is only applicable with the bolt transport connected against a 4.4 database.- Parameters:
userSelectionProvider- TheUserSelectionProviderto call before creating a session.- Returns:
- the changed builder
- Since:
- 3.2.39
-
build
-
credentials
Credentials to use to access the database- Parameters:
username- usernamepassword- password- Returns:
- the changed builder
-