-
Notifications
You must be signed in to change notification settings - Fork 15
Query DSL with Parameters
| Previous | Next | Table of Contents |
You can use parameters (JcQueryParameter) with Query DSL expressions. This allows to reuse Query DSL Expressions with different values for the specified parameters.
Note: Don't confuse this with 'Parameterized CYPHER Expressions'. 'Parameterized CYPHER Expressions' are generated in the background whenever the use of parameters with CYPHER is possible. This allows Neo4J to optimize queries.
Here is a code snippet about how to use parameters with Query DSL Expressions.
// specify a query parameter
JcQueryParameter memberName = new JcQueryParameter("memberName");
// set the parameter value
memberName.setValue("John");
// specify the query
JcNode n = new JcNode("n");
IClause[] clauses = new IClause[] {
// match nodes
MATCH.node(n).label("Member").property("name").value(memberName),
RETURN.value(n)
};
JcQuery query = new JcQuery();
query.setClauses(clauses);
// execute the query
JcQueryResult result = dbAccess.execute(query);
// modify the parameter value
memberName.setValue("Angelina");
// execute the query again
result = dbAccess.execute(query);| Previous | Next | Table of Contents |
Home
Architectural Overview
Getting Started
Graph Database Access
Query DSL Expressions
Query DSL with Parameters
Generic Graph Model
Domain Mapping
Domain Queries Predicate Expressions
Domain Queries Traversal Expressions
Domain Queries Collection Expressions 1
Domain Queries Collection Expressions 2
Domain Queries Query Concatenation
Generic Domain Model
Persisting Domain Queries
JSON Facade
Transactions
Concurrency Support
Reduce Dependencies
Outlook (Roadmap)
Future Zone