@API(status=STABLE,
since="6.0")
public final class Neo4jTemplate
extends Object
implements Neo4jOperations, FluentNeo4jOperations, BeanClassLoaderAware, BeanFactoryAware
Neo4jOperations.ExecutableQuery<T>FluentFindOperation.ExecutableFind<T>, FluentFindOperation.FindWithProjection<T>, FluentFindOperation.FindWithQuery<T>, FluentFindOperation.TerminatingFind<T>, FluentFindOperation.TerminatingFindWithoutQuery<T>| Constructor and Description |
|---|
Neo4jTemplate(Neo4jClient neo4jClient) |
Neo4jTemplate(Neo4jClient neo4jClient,
Neo4jMappingContext neo4jMappingContext) |
Neo4jTemplate(Neo4jClient neo4jClient,
Neo4jMappingContext neo4jMappingContext,
DatabaseSelectionProvider databaseSelectionProvider)
Deprecated.
|
Neo4jTemplate(Neo4jClient neo4jClient,
Neo4jMappingContext neo4jMappingContext,
DatabaseSelectionProvider databaseSelectionProvider,
EntityCallbacks entityCallbacks)
Deprecated.
|
Neo4jTemplate(Neo4jClient neo4jClient,
Neo4jMappingContext neo4jMappingContext,
EntityCallbacks entityCallbacks) |
| Modifier and Type | Method and Description |
|---|---|
long |
count(Class<?> domainType)
Counts the number of entities of a given type.
|
long |
count(org.neo4j.cypherdsl.core.Statement statement)
Counts the number of entities of a given type.
|
long |
count(org.neo4j.cypherdsl.core.Statement statement,
Map<String,Object> parameters)
Counts the number of entities of a given type.
|
long |
count(String cypherQuery)
Counts the number of entities of a given type.
|
long |
count(String cypherQuery,
Map<String,Object> parameters)
Counts the number of entities of a given type.
|
void |
deleteAll(Class<?> domainType)
Delete all entities of a given type.
|
<T> void |
deleteAllById(Iterable<?> ids,
Class<T> domainType)
Deletes all entities with one of the given ids, including all entities related to that entity.
|
<T> void |
deleteById(Object id,
Class<T> domainType)
Deletes a single entity including all entities related to that entity.
|
<T> void |
deleteByIdWithVersion(Object id,
Class<T> domainType,
Neo4jPersistentProperty versionProperty,
Object versionValue) |
<T> FluentFindOperation.ExecutableFind<T> |
find(Class<T> domainType)
Start creating a find operation for the given domainType.
|
<T> List<T> |
findAll(Class<T> domainType)
Load all entities of a given type.
|
<T> List<T> |
findAll(org.neo4j.cypherdsl.core.Statement statement,
Class<T> domainType)
Load all entities of a given type by executing given statement.
|
<T> List<T> |
findAll(org.neo4j.cypherdsl.core.Statement statement,
Map<String,Object> parameters,
Class<T> domainType)
Load all entities of a given type by executing given statement with parameters.
|
<T> List<T> |
findAll(String cypherQuery,
Class<T> domainType)
Load all entities of a given type by executing given statement.
|
<T> List<T> |
findAll(String cypherQuery,
Map<String,Object> parameters,
Class<T> domainType)
Load all entities of a given type by executing given statement with parameters.
|
<T> List<T> |
findAllById(Iterable<?> ids,
Class<T> domainType)
Load all entities of a given type that are identified by the given ids.
|
<T> Optional<T> |
findById(Object id,
Class<T> domainType)
Load an entity from the database.
|
<T> Optional<T> |
findOne(org.neo4j.cypherdsl.core.Statement statement,
Map<String,Object> parameters,
Class<T> domainType)
Load one entity of a given type by executing given statement with parameters.
|
<T> Optional<T> |
findOne(String cypherQuery,
Map<String,Object> parameters,
Class<T> domainType)
Load one entity of a given type by executing given statement with parameters.
|
<T> T |
save(T instance)
Saves an instance of an entity, including all the related entities of the entity.
|
<T> List<T> |
saveAll(Iterable<T> instances)
Saves several instances of an entity, including all the related entities of the entity.
|
<T,R> List<R> |
saveAllAs(Iterable<T> instances,
Class<R> resultType)
Saves an instance of an entity, including the properties and relationship defined by the project
resultType. |
<T,R> R |
saveAs(T instance,
Class<R> resultType)
Saves an instance of an entity, including the properties and relationship defined by the projected
resultType. |
void |
setBeanClassLoader(ClassLoader beanClassLoader) |
void |
setBeanFactory(BeanFactory beanFactory) |
<T> Neo4jOperations.ExecutableQuery<T> |
toExecutableQuery(Class<T> domainType,
QueryFragmentsAndParameters queryFragmentsAndParameters)
Create an executable query based on query fragment.
|
<T> Neo4jOperations.ExecutableQuery<T> |
toExecutableQuery(PreparedQuery<T> preparedQuery)
Takes a prepared query, containing all the information about the cypher template to be used, needed parameters and
an optional mapping function, and turns it into an executable query.
|
@Deprecated public Neo4jTemplate(Neo4jClient neo4jClient, Neo4jMappingContext neo4jMappingContext, DatabaseSelectionProvider databaseSelectionProvider)
@Deprecated public Neo4jTemplate(Neo4jClient neo4jClient, Neo4jMappingContext neo4jMappingContext, DatabaseSelectionProvider databaseSelectionProvider, EntityCallbacks entityCallbacks)
public Neo4jTemplate(Neo4jClient neo4jClient)
public Neo4jTemplate(Neo4jClient neo4jClient, Neo4jMappingContext neo4jMappingContext)
public Neo4jTemplate(Neo4jClient neo4jClient, Neo4jMappingContext neo4jMappingContext, EntityCallbacks entityCallbacks)
public long count(Class<?> domainType)
Neo4jOperationscount in interface Neo4jOperationsdomainType - the type of the entities to be counted.null.public long count(org.neo4j.cypherdsl.core.Statement statement)
Neo4jOperationscount in interface Neo4jOperationsstatement - the Cypher Statement that returns the count.null.public long count(org.neo4j.cypherdsl.core.Statement statement,
Map<String,Object> parameters)
Neo4jOperationscount in interface Neo4jOperationsstatement - the Cypher Statement that returns the count.parameters - Map of parameters. Must not be null.null.public long count(String cypherQuery)
Neo4jOperationscount in interface Neo4jOperationscypherQuery - the Cypher query that returns the count.null.public long count(String cypherQuery, Map<String,Object> parameters)
Neo4jOperationscount in interface Neo4jOperationscypherQuery - the Cypher query that returns the count.parameters - Map of parameters. Must not be null.null.public <T> List<T> findAll(Class<T> domainType)
Neo4jOperationsfindAll in interface Neo4jOperationsT - the type of the entities. Must not be null.domainType - the type of the entities. Must not be null.null.public <T> List<T> findAll(org.neo4j.cypherdsl.core.Statement statement, Class<T> domainType)
Neo4jOperationsfindAll in interface Neo4jOperationsT - the type of the entities. Must not be null.statement - Cypher Statement. Must not be null.domainType - the type of the entities. Must not be null.null.public <T> List<T> findAll(org.neo4j.cypherdsl.core.Statement statement, Map<String,Object> parameters, Class<T> domainType)
Neo4jOperationsfindAll in interface Neo4jOperationsT - the type of the entities. Must not be null.statement - Cypher Statement. Must not be null.parameters - Map of parameters. Must not be null.domainType - the type of the entities. Must not be null.null.public <T> Optional<T> findOne(org.neo4j.cypherdsl.core.Statement statement, Map<String,Object> parameters, Class<T> domainType)
Neo4jOperationsfindOne in interface Neo4jOperationsT - the type of the entities. Must not be null.statement - Cypher Statement. Must not be null.parameters - Map of parameters. Must not be null.domainType - the type of the entities. Must not be null.null.public <T> List<T> findAll(String cypherQuery, Class<T> domainType)
Neo4jOperationsfindAll in interface Neo4jOperationsT - the type of the entities. Must not be null.cypherQuery - Cypher query string. Must not be null.domainType - the type of the entities. Must not be null.null.public <T> List<T> findAll(String cypherQuery, Map<String,Object> parameters, Class<T> domainType)
Neo4jOperationsfindAll in interface Neo4jOperationsT - the type of the entities. Must not be null.cypherQuery - Cypher query string. Must not be null.parameters - Map of parameters. Must not be null.domainType - the type of the entities. Must not be null.null.public <T> Optional<T> findOne(String cypherQuery, Map<String,Object> parameters, Class<T> domainType)
Neo4jOperationsfindOne in interface Neo4jOperationsT - the type of the entities. Must not be null.cypherQuery - Cypher query string. Must not be null.parameters - Map of parameters. Must not be null.domainType - the type of the entities. Must not be null.null.public <T> FluentFindOperation.ExecutableFind<T> find(Class<T> domainType)
FluentFindOperationfind in interface FluentFindOperationdomainType - must not be null.FluentFindOperation.ExecutableFind.public <T> Optional<T> findById(Object id, Class<T> domainType)
Neo4jOperationsfindById in interface Neo4jOperationsT - the type of the entity.id - the id of the entity to load. Must not be null.domainType - the type of the entity. Must not be null.public <T> List<T> findAllById(Iterable<?> ids, Class<T> domainType)
Neo4jOperationsfindAllById in interface Neo4jOperationsT - the type of the entities. Must not be null.ids - of the entities identifying the entities to load. Must not be null.domainType - the type of the entities. Must not be null.null.public <T> T save(T instance)
Neo4jOperationssave in interface Neo4jOperationsT - the type of the entity.instance - the entity to be saved. Must not be null.public <T,R> R saveAs(T instance,
Class<R> resultType)
Neo4jOperationsresultType.saveAs in interface Neo4jOperationsT - the type of the entity.R - the type of the projection to be used during save.instance - the entity to be saved. Must not be null.public <T> List<T> saveAll(Iterable<T> instances)
Neo4jOperationssaveAll in interface Neo4jOperationsT - the type of the entity.instances - the instances to be saved. Must not be null.public <T,R> List<R> saveAllAs(Iterable<T> instances, Class<R> resultType)
Neo4jOperationsresultType.saveAllAs in interface Neo4jOperationsT - the type of the entity.R - the type of the projection to be used during save.instances - the instances to be saved. Must not be null.public <T> void deleteById(Object id, Class<T> domainType)
Neo4jOperationsdeleteById in interface Neo4jOperationsT - the type of the entity.id - the id of the entity to be deleted. Must not be null.domainType - the type of the entitypublic <T> void deleteByIdWithVersion(Object id, Class<T> domainType, Neo4jPersistentProperty versionProperty, Object versionValue)
deleteByIdWithVersion in interface Neo4jOperationspublic <T> void deleteAllById(Iterable<?> ids, Class<T> domainType)
Neo4jOperationsdeleteAllById in interface Neo4jOperationsT - the type of the entity.ids - the ids of the entities to be deleted. Must not be null.domainType - the type of the entitypublic void deleteAll(Class<?> domainType)
Neo4jOperationsdeleteAll in interface Neo4jOperationsdomainType - type of the entities to be deleted. Must not be null.public void setBeanClassLoader(ClassLoader beanClassLoader)
setBeanClassLoader in interface BeanClassLoaderAwarepublic void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory in interface BeanFactoryAwareBeansExceptionpublic <T> Neo4jOperations.ExecutableQuery<T> toExecutableQuery(Class<T> domainType, QueryFragmentsAndParameters queryFragmentsAndParameters)
Neo4jOperationstoExecutableQuery in interface Neo4jOperationsT - The type of the objects returned by this query.domainType - domain class the executable query should returnqueryFragmentsAndParameters - fragments and parameters to construct the query frompublic <T> Neo4jOperations.ExecutableQuery<T> toExecutableQuery(PreparedQuery<T> preparedQuery)
Neo4jOperationstoExecutableQuery in interface Neo4jOperationsT - The type of the objects returned by this query.preparedQuery - prepared query that should get converted to an executable queryCopyright © 2019–2021 Neo4j, Neo4j Sweden AB. All rights reserved.