Session@Deprecated public class Neo4jTemplate extends Object implements Neo4jOperations, InitializingBean
Neo4jOperations. Indeed, framework users are encouraged
to favour coding against the Neo4jOperations interface rather than the Neo4jTemplate directly, as the
interface API will be more consistent over time and enhanced proxy objects of the interface may actually be created by Spring
for auto-wiring instead of this template.
Please note also that all methods on this class throw a DataAccessException if any underlying Exception is
thrown. Since DataAccessException is a runtime exception, this is not documented at the method level.| Constructor and Description |
|---|
Neo4jTemplate()
Deprecated.
Create a new Neo4jTemplate instance.
|
Neo4jTemplate(org.neo4j.ogm.session.SessionFactory sessionFactory)
Deprecated.
Constructs a new
Neo4jTemplate based on the given Neo4j OGM SessionFactory. |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Deprecated.
|
void |
clear()
Deprecated.
Removes all mapping information from the current session
|
long |
count(Class<?> entityClass)
Deprecated.
Provides the instance count for the given node entity type.
|
void |
delete(Object entity)
Deprecated.
Removes the given node or relationship entity from the graph.
|
<T> void |
deleteAll(Class<T> type)
Deprecated.
Removes all nodes or relationship entities of a specific type from the graph.
|
<T> T |
execute(Neo4jCallback<T> action)
Deprecated.
Execute the action specified by the given action object within a
Session. |
org.neo4j.ogm.session.SessionFactory |
getSessionFactory()
Deprecated.
|
<T> T |
load(Class<T> type,
Long id)
Deprecated.
Loads an entity of type T that matches the specified ID to the default depth.
|
<T> T |
load(Class<T> type,
Long id,
int depth)
Deprecated.
Loads an entity of type T that matches the specified ID to the given depth.
|
<T> Collection<T> |
loadAll(Class<T> type)
Deprecated.
Retrieves all the entities of the given class in the database hydrated to the default depth.
|
<T> Collection<T> |
loadAll(Class<T> type,
Collection<Long> ids)
Deprecated.
|
<T> Collection<T> |
loadAll(Class<T> type,
Collection<Long> ids,
int depth)
Deprecated.
Reloads all of the entities which match IDs in the given
Collection to the specified depth. |
<T> Collection<T> |
loadAll(Class<T> type,
Collection<Long> ids,
org.neo4j.ogm.cypher.query.SortOrder sortOrder,
int depth)
Deprecated.
Reloads all of the entities in the given
Collection to the specified depth, sorted by the sprcified SortOrder Of course, this will
only work for persistent objects (i.e., those with a non-null @GraphId field). |
<T> Collection<T> |
loadAll(Class<T> type,
org.neo4j.ogm.cypher.Filter filter)
Deprecated.
Retrieves all the entities of the given class in the database hydrated to the default depth conforming to the specified
filter criteria.
|
<T> Collection<T> |
loadAll(Class<T> type,
org.neo4j.ogm.cypher.Filter filter,
int depth)
Deprecated.
Retrieves all the entities of the given class in the database hydrated to the default depth conforming to the specified
filter criteria.
|
<T> Collection<T> |
loadAll(Class<T> type,
int depth)
Deprecated.
Retrieves all the entities of the given class in the database hydrated to the specified depth.
|
<T> Collection<T> |
loadAll(Class<T> type,
org.neo4j.ogm.cypher.query.Pagination pagination,
int depth)
Deprecated.
Retrieves all the entities of the given class in the database hydrated to the specified depth, with Pagination.
|
<T> Collection<T> |
loadAll(Class<T> type,
org.neo4j.ogm.cypher.query.SortOrder sortOrder,
int depth)
Deprecated.
Retrieves all the entities of the given class in the database hydrated to the specified depth, with Sorting.
|
<T> Collection<T> |
loadAll(Class<T> type,
org.neo4j.ogm.cypher.query.SortOrder sortOrder,
org.neo4j.ogm.cypher.query.Pagination pagination,
int depth)
Deprecated.
Retrieves all the entities of the given class in the database hydrated to the specified depth, with Sorting and Pagination.
|
<T> Collection<T> |
loadAll(Collection<T> objects)
Deprecated.
|
<T> Collection<T> |
loadAll(Collection<T> objects,
int depth)
Deprecated.
Reloads all of the entities in the given
Collection to the specified depth. |
<T> Collection<T> |
loadAllByProperties(Class<T> type,
org.neo4j.ogm.cypher.Filters parameters)
Deprecated.
Retrieves all the entities of the specified type that contain a properties matching the ones supplied with given name and value.
|
<T> Collection<T> |
loadAllByProperties(Class<T> type,
org.neo4j.ogm.cypher.Filters parameters,
int depth)
Deprecated.
Retrieves all the entities of the specified type that contain a properties matching the ones supplied with given name and value.
|
<T> Collection<T> |
loadAllByProperty(Class<T> type,
String name,
Object value)
Deprecated.
Retrieves all the entities of the specified type that contain a property matching the given name with the given value.
|
<T> Collection<T> |
loadAllByProperty(Class<T> type,
String name,
Object value,
int depth)
Deprecated.
Retrieves all the entities of the specified type that contain a property matching the given name with the given value.
|
<T> T |
loadByProperties(Class<T> type,
org.neo4j.ogm.cypher.Filters parameters)
Deprecated.
Retrieves the entity of the specified type that contains properties matching the ones supplied with given name and value.
|
<T> T |
loadByProperties(Class<T> type,
org.neo4j.ogm.cypher.Filters parameters,
int depth)
Deprecated.
Retrieves the entity of the specified type that contains properties matching the ones supplied with given name and value.
|
<T> T |
loadByProperty(Class<T> type,
String propertyName,
Object propertyValue)
Deprecated.
Retrieves the entity of the specified type that contains a property matching the given name with the given value.
|
<T> T |
loadByProperty(Class<T> type,
String propertyName,
Object propertyValue,
int depth)
Deprecated.
Retrieves the entity of the specified type that contains a property matching the given name with the given value.
|
<T> T |
loadByPropertyOrNull(Class<T> type,
String propertyName,
Object propertyValue)
Deprecated.
|
org.neo4j.ogm.model.Result |
query(String cypher,
Map<String,?> parameters)
Deprecated.
|
org.neo4j.ogm.model.Result |
query(String cypher,
Map<String,?> parameters,
boolean readOnly)
Deprecated.
Given a cypher statement this method will return a
Query object containing a collection of Map's which represent Neo4j
objects as properties, along with query statistics if applicable. |
<T> T |
queryForObject(Class<T> objectType,
String cypher,
Map<String,?> parameters)
Deprecated.
Runs the specified Cypher query with the given parameters against the underlying Neo4j database and returns the result
marshalled as an object of the requested type.
|
<T> Iterable<T> |
queryForObjects(Class<T> objectType,
String cypher,
Map<String,?> parameters)
Deprecated.
Runs the specified Cypher query with the given parameters against the underlying Neo4j database and returns the result
marshalled as a group of objects of the requested type.
|
<T> T |
save(T entity)
Deprecated.
Saves the specified entity in the graph database.
|
<T> T |
save(T entity,
int depth)
Deprecated.
Saves the specified entity in the graph database to a custom depth.
|
void |
setSessionFactory(org.neo4j.ogm.session.SessionFactory sessionFactory)
Deprecated.
|
public Neo4jTemplate()
@Autowired public Neo4jTemplate(org.neo4j.ogm.session.SessionFactory sessionFactory)
Neo4jTemplate based on the given Neo4j OGM SessionFactory.sessionFactory - The Neo4j OGM SessionFactory upon which to base the templatepublic void setSessionFactory(org.neo4j.ogm.session.SessionFactory sessionFactory)
public org.neo4j.ogm.session.SessionFactory getSessionFactory()
public void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanpublic <T> T execute(Neo4jCallback<T> action) throws DataAccessException
Neo4jOperationsSession.
Application exceptions thrown by the action object get propagated to the caller (can only be unchecked). OGM exceptions are transformed into appropriate DAO ones. Allows for returning a result object, that is a domain object or a collection of domain objects.
Note: Callback code is not supposed to handle transactions itself!
Use an appropriate transaction manager like
Neo4jTransactionManager. Generally, callback code must not
touch any Session lifecycle methods, like close,
disconnect, or reconnect, to let the template do its work.
execute in interface Neo4jOperationsaction - callback object that specifies the OGM actionnullDataAccessExceptionSessionpublic <T> T load(Class<T> type, Long id)
Neo4jOperationsload in interface Neo4jOperationstype - The type of entity to loadid - The ID of the node or relationship to matchnull if no match is foundpublic <T> T load(Class<T> type, Long id, int depth)
Neo4jOperationsload in interface Neo4jOperationstype - The type of entity to loadid - The ID of the node or relationship to matchdepth - The maximum number of relationships away from the identified object to follow when loading related entities.
A value of 0 just loads the object's properties and no related entities. A value of -1 implies no depth limit.null if no match is foundpublic <T> Collection<T> loadAll(Class<T> type, Collection<Long> ids)
public <T> Collection<T> loadAll(Class<T> type, Collection<Long> ids, int depth)
Neo4jOperationsCollection to the specified depth. Of course, this will
only work for persistent objects (i.e., those with a non-null @GraphId field).loadAll in interface Neo4jOperationstype - The type of entity to return.ids - The IDs of objects to re-hydratedepth - The depth to which the objects should be hydratedCollection of entities matching those in the given collection hydrated to the given depthpublic <T> Collection<T> loadAll(Class<T> type)
Neo4jOperationsloadAll in interface Neo4jOperationstype - The type of entity to return.Collection containing all instances of the given type in the database or an empty collection if none
are found, never nullpublic <T> Collection<T> loadAll(Class<T> type, int depth)
Neo4jOperationsloadAll in interface Neo4jOperationstype - The type of entity to return.depth - The maximum number of relationships away from each loaded object to follow when loading related entities.
A value of 0 just loads the object's properties and no related entities. A value of -1 implies no depth limit.Collection containing all instances of the given type in the database or an empty collection if none
are found, never nullpublic <T> Collection<T> loadAll(Class<T> type, org.neo4j.ogm.cypher.query.SortOrder sortOrder, int depth)
Neo4jOperationsloadAll in interface Neo4jOperationstype - The type of entity to return.sortOrder - The SortOrder to be applieddepth - The maximum number of relationships away from each loaded object to follow when loading related entities.
A value of 0 just loads the object's properties and no related entities. A value of -1 implies no depth limit.Collection containing all instances of the given type in the database or an empty collection if none
are found, never nullpublic <T> Collection<T> loadAll(Class<T> type, org.neo4j.ogm.cypher.query.SortOrder sortOrder, org.neo4j.ogm.cypher.query.Pagination pagination, int depth)
Neo4jOperationsloadAll in interface Neo4jOperationstype - The type of entity to return.sortOrder - The SortOrder to be appliedpagination - The Pagination to be applieddepth - The maximum number of relationships away from each loaded object to follow when loading related entities.
A value of 0 just loads the object's properties and no related entities. A value of -1 implies no depth limit.Collection containing all instances of the given type in the database or an empty collection if none
are found, never nullpublic <T> Collection<T> loadAll(Collection<T> objects)
public <T> Collection<T> loadAll(Collection<T> objects, int depth)
Neo4jOperationsCollection to the specified depth. Of course, this will
only work for persistent objects (i.e., those with a non-null @GraphId field).loadAll in interface Neo4jOperationsobjects - The objects to re-hydratedepth - The depth to which the objects should be hydratedCollection of entities matching those in the given collection hydrated to the given depthpublic <T> Collection<T> loadAll(Class<T> type, Collection<Long> ids, org.neo4j.ogm.cypher.query.SortOrder sortOrder, int depth)
Neo4jOperationsCollection to the specified depth, sorted by the sprcified SortOrder Of course, this will
only work for persistent objects (i.e., those with a non-null @GraphId field).loadAll in interface Neo4jOperationsids - The IDs of objects to re-hydratesortOrder - The SortOrder to be useddepth - The depth to which the objects should be hydratedCollection of entities matching those in the given collection hydrated to the given depthpublic <T> Collection<T> loadAll(Class<T> type, org.neo4j.ogm.cypher.Filter filter)
Neo4jOperationsloadAll in interface Neo4jOperationstype - The type of entity to return.filter - The filter to constrain entities with.Collection containing all matching instances of the given type in the database or an empty collection if none
are found, never nullpublic <T> Collection<T> loadAll(Class<T> type, org.neo4j.ogm.cypher.query.Pagination pagination, int depth)
Neo4jOperationsloadAll in interface Neo4jOperationstype - The type of entity to return.pagination - The Pagination to be applieddepth - The maximum number of relationships away from each loaded object to follow when loading related entities.
A value of 0 just loads the object's properties and no related entities. A value of -1 implies no depth limit.Collection containing all instances of the given type in the database or an empty collection if none
are found, never nullpublic <T> Collection<T> loadAll(Class<T> type, org.neo4j.ogm.cypher.Filter filter, int depth)
Neo4jOperationsloadAll in interface Neo4jOperationstype - The type of entity to return.filter - The filter to constrain entities with.depth - The depth to which the objects should be hydratedCollection containing all matching instances of the given type in the database or an empty collection if none
are found, never nullpublic <T> T loadByProperty(Class<T> type, String propertyName, Object propertyValue)
Neo4jOperationsNeo4jOperations.loadAllByProperty(Class, String, Object) instead.loadByProperty in interface Neo4jOperationstype - The type of entity to loadpropertyName - The name of the property on the entity against which to match the given valuepropertyValue - The value of the named property against which to match entitiesnullpublic <T> T loadByProperty(Class<T> type, String propertyName, Object propertyValue, int depth)
Neo4jOperationsNeo4jOperations.loadAllByProperty(Class, String, Object) instead.loadByProperty in interface Neo4jOperationstype - The type of entity to loadpropertyName - The name of the property on the entity against which to match the given valuepropertyValue - The value of the named property against which to match entitiesdepth - The maximum number of relationships away from each loaded object to follow when loading related entities.
A value of 0 just loads the object's properties and no related entities. A value of -1 implies no depth limit.nullpublic <T> T loadByPropertyOrNull(Class<T> type, String propertyName, Object propertyValue)
public <T> Collection<T> loadAllByProperty(Class<T> type, String name, Object value)
Neo4jOperationsloadAllByProperty in interface Neo4jOperationstype - The type of entity to loadname - The name of the property on the entity against which to match the given valuevalue - The value of the named property against which to match entitiesCollection containing all the entities that match the given property or an empty Collection if
there aren't any matches, never nullpublic <T> T loadByProperties(Class<T> type, org.neo4j.ogm.cypher.Filters parameters)
Neo4jOperationsNeo4jOperations.loadAllByProperty(Class, String, Object) instead.loadByProperties in interface Neo4jOperationstype - The type of entity to loadparameters - The parameters to filter bynullpublic <T> T loadByProperties(Class<T> type, org.neo4j.ogm.cypher.Filters parameters, int depth)
Neo4jOperationsNeo4jOperations.loadAllByProperty(Class, String, Object) instead.loadByProperties in interface Neo4jOperationstype - The type of entity to loadparameters - The parameters to filter bydepth - The maximum number of relationships away from each loaded object to follow when loading related entities.
A value of 0 just loads the object's properties and no related entities. A value of -1 implies no depth limit.nullpublic <T> Collection<T> loadAllByProperties(Class<T> type, org.neo4j.ogm.cypher.Filters parameters)
Neo4jOperationsloadAllByProperties in interface Neo4jOperationstype - The type of entity to loadparameters - The parameters to filter byCollection containing all the entities that match the given properties or an empty Collection if
there aren't any matches, never nullpublic <T> Collection<T> loadAllByProperties(Class<T> type, org.neo4j.ogm.cypher.Filters parameters, int depth)
Neo4jOperationsloadAllByProperties in interface Neo4jOperationstype - The type of entity to loadparameters - The parameters to filter bydepth - The maximum number of relationships away from each loaded object to follow when loading related entities.
A value of 0 just loads the object's properties and no related entities. A value of -1 implies no depth limit.Collection containing all the entities that match the given properties or an empty Collection if
there aren't any matches, never nullpublic <T> Collection<T> loadAllByProperty(Class<T> type, String name, Object value, int depth)
Neo4jOperationsloadAllByProperty in interface Neo4jOperationstype - The type of entity to loadname - The name of the property on the entity against which to match the given valuevalue - The value of the named property against which to match entitiesdepth - The maximum number of relationships away from each loaded object to follow when loading related entities.
A value of 0 just loads the object's properties and no related entities. A value of -1 implies no depth limit.Collection containing all the entities that match the given property or an empty Collection if
there aren't any matches, never nullpublic void delete(Object entity)
Neo4jOperationsdelete in interface Neo4jOperationsentity - The entity to deletepublic void clear()
Neo4jOperationsclear in interface Neo4jOperationspublic <T> void deleteAll(Class<T> type)
Neo4jOperationsdeleteAll in interface Neo4jOperationstype - the type of entity to deletepublic <T> T save(T entity)
Neo4jOperationssave in interface Neo4jOperationsentity - The entity to savepublic <T> T save(T entity,
int depth)
Neo4jOperationssave in interface Neo4jOperationsentity - The entity to savedepth - The maximum number of relationships away from the entity to follow when saving related entities.
A value of 0 just saves the object's properties and no related entities. A value of -1 implies no depth limit.public org.neo4j.ogm.model.Result query(String cypher, Map<String,?> parameters)
Neo4jOperationsIterable of Maps.
Each of the resultant maps corresponds to a "row" in the result set and the key set in each map contains all the names
contained in the RETURN clause of the given query.
query in interface Neo4jOperationscypher - The Cypher query to executeparameters - The parameter to merge into the cypher query or an empty Map if the given query isn't parameterisedQuery containing an Iterable map representing query results and QueryStatistics if applicable.public <T> Iterable<T> queryForObjects(Class<T> objectType, String cypher, Map<String,?> parameters)
Neo4jOperationsqueryForObjects in interface Neo4jOperationsobjectType - The Class denoting the type of entity to returncypher - The Cypher query to executeparameters - The parameter to merge into the Cypher query or an empty Map if the query's not parameterisedIterable over the entities found by executing the query or an empty Iterable if nothing
is found by the query, never nullpublic org.neo4j.ogm.model.Result query(String cypher, Map<String,?> parameters, boolean readOnly)
Neo4jOperationsQuery object containing a collection of Map's which represent Neo4j
objects as properties, along with query statistics if applicable.
Each element of the query result is a map which you can access by the name of the returned field
TODO: Are we going to use the neo4jOperations conversion method to cast the value object to its proper class?query in interface Neo4jOperationscypher - The parametrisable cypher to execute.parameters - Any parameters to attach to the cypher.readOnly - true if the query is readOnly, false otherwiseQuery of Iterables with each entry representing a neo4j object's properties.public <T> T queryForObject(Class<T> objectType, String cypher, Map<String,?> parameters)
Neo4jOperationsqueryForObject in interface Neo4jOperationsobjectType - The Class denoting the type of entity to returncypher - The Cypher query to executeparameters - The parameter to merge into the Cypher query or an empty Map if the query's not parameterisednull if nothing is
found by the querypublic long count(Class<?> entityClass)
Neo4jOperationscount in interface Neo4jOperationsentityClass - The Class representing the type of node entity to countCopyright © 2011-2015–2017 Pivotal Software, Inc.. All rights reserved.