Interface ExecutableStatement

  • All Known Subinterfaces:
    ExecutableResultStatement, ReactiveExecutableResultStatement, ReactiveExecutableStatement

    @API(status=EXPERIMENTAL,
         since="2021.2.1")
    public interface ExecutableStatement
    This interface spots several methods that allow statements to be used with an instance of the Neo4j Java Driver. To use any of the executeWithXXX methods, the driver must be present on the class path. The corresponding Java module is org.neo4j.driver.

    An ExecutableResultStatement makes a ResultStatement executable.

    We don't add any overhead to the process but only use what's already there. The QueryRunner passed to any of the methods can be a session, a transaction or also the Spring Data Neo4j specific query runner.

    We don't commit or rollback any transaction nor do we close a session. That is up to the caller.

    Any parameter in this statement containing a value will be passed directly to the driver. The driver does a relatively good job converting most parameters. If in doubt or the result is wrong, use an appropriate overload of org.neo4j.driver.Values#value(parameter) to convert the parameter.

    Use any of the of(Statement) or makeExecutable(Statement) methods to get an appropriate instance. The of methods are useful when you are using qualified imports, the makeExecutable-variant comes in handy with static imports.

    Since:
    2021.2.1
    Author:
    Michael J. Simons
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<org.neo4j.driver.summary.ResultSummary> executeWith​(org.neo4j.driver.async.AsyncQueryRunner queryRunner)
      If the Neo4j Java Driver is on the classpath, this method can be used to pass a QueryRunner to the statement, execute it and retrieve a result summary in an asynchronous fashion
      org.neo4j.driver.summary.ResultSummary executeWith​(org.neo4j.driver.QueryRunner queryRunner)
      If the Neo4j Java Driver is on the classpath, this method can be used to pass a QueryRunner to the statement, execute it and retrieve a result summary.
      @NotNull java.lang.String getCypher()  
      @NotNull java.util.Collection<java.lang.String> getParameterNames()  
      @NotNull java.util.Map<java.lang.String,​java.lang.Object> getParameters()  
      static ExecutableResultStatement makeExecutable​(ResultStatement statement)
      Creates an executable result statement based on the given statement
      static ExecutableStatement makeExecutable​(Statement statement)
      Creates an executable statement based on the given statement
      static ExecutableResultStatement of​(ResultStatement statement)
      Creates an executable result statement based on the given statement
      static ExecutableStatement of​(Statement statement)
      Creates an executable statement based on the given statement
    • Method Detail

      • getParameters

        @NotNull
        @Contract(pure=true)
        @NotNull java.util.Map<java.lang.String,​java.lang.Object> getParameters()
        Returns:
        A map of all parameters with a bound value.
        See Also:
        Statement.getParameters()
      • getParameterNames

        @NotNull
        @Contract(pure=true)
        @NotNull java.util.Collection<java.lang.String> getParameterNames()
        Returns:
        A set of parameter names being used.
        See Also:
        Statement.getParameterNames()
      • getCypher

        @NotNull
        @Contract(pure=true)
        @NotNull java.lang.String getCypher()
        Returns:
        A valid Cypher statement
        See Also:
        Statement.getCypher()
      • executeWith

        org.neo4j.driver.summary.ResultSummary executeWith​(org.neo4j.driver.QueryRunner queryRunner)
        If the Neo4j Java Driver is on the classpath, this method can be used to pass a QueryRunner to the statement, execute it and retrieve a result summary.

        All parameters with given values will be passed to the database. Please have a look at ResultStatement for further details about parameter conversions

        No resources passed to this method (neither sessions, transactions nor other query runners) will be closed. Resources opened inside the method will be closed.

        Parameters:
        queryRunner - a query runner
        Returns:
        A result summary (including server information, counters etc).
      • executeWith

        java.util.concurrent.CompletableFuture<org.neo4j.driver.summary.ResultSummary> executeWith​(org.neo4j.driver.async.AsyncQueryRunner queryRunner)
        If the Neo4j Java Driver is on the classpath, this method can be used to pass a QueryRunner to the statement, execute it and retrieve a result summary in an asynchronous fashion

        All parameters with given values will be passed to the database. Please have a look at ResultStatement for further details about parameter conversions

        No resources passed to this method (neither sessions, transactions nor other query runners) will be closed. Resources opened inside the method will be closed.

        Parameters:
        queryRunner - a query runner
        Returns:
        A completable future of a result summary (including server information, counters etc).