java.lang.Object
org.neo4j.driver.QueryConfig.Builder
- Enclosing class:
- QueryConfig
Builder used to configure
QueryConfig
which will be used to execute a query.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Create a config instance from this builder.withBookmarkManager
(BookmarkManager bookmarkManager) Set bookmark manager for the query.withDatabase
(String database) Set target database for the query.withImpersonatedUser
(String impersonatedUser) Set impersonated user for the query.withMetadata
(Map<String, Serializable> metadata) Set the transaction metadata.withRouting
(RoutingControl routing) Set routing mode for the query.withTimeout
(Duration timeout) Set the transaction timeout.
-
Method Details
-
withRouting
Set routing mode for the query.- Parameters:
routing
- routing mode- Returns:
- this builder
-
withDatabase
Set target database for the query.- Parameters:
database
- database- Returns:
- this builder
-
withImpersonatedUser
Set impersonated user for the query.- Parameters:
impersonatedUser
- impersonated user- Returns:
- this builder
-
withBookmarkManager
Set bookmark manager for the query.- Parameters:
bookmarkManager
- bookmark manager- Returns:
- this builder
-
withTimeout
Set the transaction timeout. Transactions that execute longer than the configured timeout will be terminated by the database.This functionality allows user code to limit query/transaction execution time. The specified timeout overrides the default timeout configured in the database using the
db.transaction.timeout
setting (dbms.transaction.timeout
before Neo4j 5.0). Values higher thandb.transaction.timeout
will be ignored and will fall back to the default for server versions between 4.2 and 5.2 (inclusive).The provided value should not represent a negative duration.
Duration.ZERO
will make the transaction execute indefinitely.- Parameters:
timeout
- the timeout.- Returns:
- this builder.
- Since:
- 5.16
-
withMetadata
Set the transaction metadata.- Parameters:
metadata
- the metadata, must not benull
.- Returns:
- this builder.
- Since:
- 5.16
-
build
Create a config instance from this builder.- Returns:
- a new
QueryConfig
instance.
-