public class Neo4jSession extends Object implements Session
| Constructor and Description |
|---|
Neo4jSession(MetaData metaData,
Driver driver) |
Neo4jSession(MetaData metaData,
Driver driver,
List<EventListener> eventListeners) |
| Modifier and Type | Method and Description |
|---|---|
Transaction |
beginTransaction()
Begin a new READ_WRITE transaction.
|
Transaction |
beginTransaction(Transaction.Type type)
Begin a new transaction, passing in the required type (READ_ONLY, READ_WRITE).
|
void |
clear() |
MappingContext |
context() |
long |
count(Class<?> clazz,
Iterable<Filter> filters)
Counts all the node entities of the specified type which match the filters supplied
|
long |
countEntitiesOfType(Class<?> entity)
Counts all the node entities of the specified type.
|
void |
debug(String msg) |
<T> Object |
delete(Class<T> type,
Iterable<Filter> filters,
boolean listResults) |
<T> void |
delete(T object) |
<T> void |
deleteAll(Class<T> type) |
boolean |
detachNodeEntity(Long id) |
boolean |
detachRelationshipEntity(Long id) |
boolean |
dispose(EventListener eventListener) |
<T> T |
doInTransaction(GraphCallback<T> graphCallback)
Deprecated.
|
String |
entityType(String name) |
boolean |
eventsEnabled() |
String |
getLastBookmark()
Retrieves the last bookmark used in this session when used in a Neo4j Causal Cluster.
|
Transaction |
getTransaction()
Get the existing transaction if available
|
void |
info(String msg) |
<T,ID extends Serializable> |
load(Class<T> type,
ID id) |
<T,ID extends Serializable> |
load(Class<T> type,
ID id,
int depth) |
<T> Collection<T> |
loadAll(Class<T> type) |
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids) |
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
int depth) |
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
Pagination paging) |
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
Pagination paging,
int depth) |
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
SortOrder sortOrder) |
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
SortOrder sortOrder,
int depth) |
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
SortOrder sortOrder,
Pagination pagination) |
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
SortOrder sortOrder,
Pagination pagination,
int depth) |
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter) |
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
int depth) |
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
Pagination pagination) |
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
Pagination pagination,
int depth) |
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters) |
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
int depth) |
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
SortOrder sortOrder) |
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
SortOrder sortOrder,
int depth) |
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
SortOrder sortOrder,
Pagination pagination) |
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
SortOrder sortOrder,
Pagination pagination,
int depth) |
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
Pagination pagination) |
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
Pagination pagination,
int depth) |
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
SortOrder sortOrder) |
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
SortOrder sortOrder,
int depth) |
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
SortOrder sortOrder,
Pagination pagination) |
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
SortOrder sortOrder,
Pagination pagination,
int depth) |
<T> Collection<T> |
loadAll(Class<T> type,
int depth) |
<T> Collection<T> |
loadAll(Class<T> type,
Pagination paging) |
<T> Collection<T> |
loadAll(Class<T> type,
Pagination paging,
int depth) |
<T> Collection<T> |
loadAll(Class<T> type,
SortOrder sortOrder) |
<T> Collection<T> |
loadAll(Class<T> type,
SortOrder sortOrder,
int depth) |
<T> Collection<T> |
loadAll(Class<T> type,
SortOrder sortOrder,
Pagination pagination) |
<T> Collection<T> |
loadAll(Class<T> type,
SortOrder sortOrder,
Pagination pagination,
int depth) |
<T> Collection<T> |
loadAll(Collection<T> objects) |
<T> Collection<T> |
loadAll(Collection<T> objects,
int depth) |
<T> Collection<T> |
loadAll(Collection<T> objects,
Pagination pagination) |
<T> Collection<T> |
loadAll(Collection<T> objects,
Pagination pagination,
int depth) |
<T> Collection<T> |
loadAll(Collection<T> objects,
SortOrder sortOrder) |
<T> Collection<T> |
loadAll(Collection<T> objects,
SortOrder sortOrder,
int depth) |
<T> Collection<T> |
loadAll(Collection<T> objects,
SortOrder sortOrder,
Pagination pagination) |
<T> Collection<T> |
loadAll(Collection<T> objects,
SortOrder sortOrder,
Pagination pagination,
int depth) |
MetaData |
metaData() |
void |
notifyListeners(Event event) |
void |
purgeDatabase() |
<T> Iterable<T> |
query(Class<T> type,
String cypher,
Map<String,?> parameters)
Given a cypher statement this method will return a collection of domain objects that is hydrated to
the default level or a collection of scalars (depending on the parametrized type).
|
Result |
query(String cypher,
Map<String,?> parameters)
Given a cypher statement this method will return a Result object containing a collection of Map's which represent Neo4j
objects as properties, along with query statistics if applicable.
|
Result |
query(String cypher,
Map<String,?> parameters,
boolean readOnly)
Given a cypher statement this method will return a Result object containing a collection of Map's which represent Neo4j
objects as properties, along with query statistics if applicable.
|
<T> T |
queryForObject(Class<T> type,
String cypher,
Map<String,?> parameters)
Given a cypher statement this method will return a domain object that is hydrated to the
default level or a scalar (depending on the parametrized type).
|
<T,ID extends Serializable> |
queryStatementsFor(Class<T> type) |
EventListener |
register(EventListener eventListener) |
Request |
requestHandler() |
Long |
resolveGraphIdFor(Object possibleEntity)
Resolve the graph id for a possible entity
|
void |
resolvePropertyAnnotations(Class entityType,
Iterable<Filter> filters) |
void |
resolvePropertyAnnotations(Class entityType,
SortOrder sortOrder) |
<T> void |
save(T object) |
<T> void |
save(T object,
int depth) |
void |
setDriver(Driver driver) |
DefaultTransactionManager |
transactionManager() |
void |
warn(String msg) |
void |
withBookmark(String bookmark)
Sets the bookmark to use on this session.
|
public Neo4jSession(MetaData metaData, Driver driver, List<EventListener> eventListeners)
public EventListener register(EventListener eventListener)
public void notifyListeners(Event event)
notifyListeners in interface Observerpublic boolean eventsEnabled()
eventsEnabled in interface Observerpublic boolean dispose(EventListener eventListener)
public <T,ID extends Serializable> T load(Class<T> type, ID id)
load in interface Capability.LoadOnepublic <T,ID extends Serializable> T load(Class<T> type, ID id, int depth)
load in interface Capability.LoadOnepublic <T> Collection<T> loadAll(Class<T> type)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, int depth)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Pagination paging)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Pagination paging, int depth)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, SortOrder sortOrder)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, SortOrder sortOrder, int depth)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, SortOrder sortOrder, Pagination pagination)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, SortOrder sortOrder, Pagination pagination, int depth)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filter filter)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filter filter, int depth)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filter filter, SortOrder sortOrder)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filter filter, SortOrder sortOrder, int depth)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filter filter, Pagination pagination)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filter filter, Pagination pagination, int depth)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filter filter, SortOrder sortOrder, Pagination pagination)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filter filter, SortOrder sortOrder, Pagination pagination, int depth)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filters filters)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filters filters, int depth)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filters filters, SortOrder sortOrder)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filters filters, SortOrder sortOrder, int depth)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filters filters, Pagination pagination)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filters filters, Pagination pagination, int depth)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filters filters, SortOrder sortOrder, Pagination pagination)
loadAll in interface Capability.LoadByTypepublic <T> Collection<T> loadAll(Class<T> type, Filters filters, SortOrder sortOrder, Pagination pagination, int depth)
loadAll in interface Capability.LoadByTypepublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids)
loadAll in interface Capability.LoadByIdspublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, int depth)
loadAll in interface Capability.LoadByIdspublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, SortOrder sortOrder)
loadAll in interface Capability.LoadByIdspublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, SortOrder sortOrder, int depth)
loadAll in interface Capability.LoadByIdspublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, Pagination paging)
loadAll in interface Capability.LoadByIdspublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, Pagination paging, int depth)
loadAll in interface Capability.LoadByIdspublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, SortOrder sortOrder, Pagination pagination)
loadAll in interface Capability.LoadByIdspublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, SortOrder sortOrder, Pagination pagination, int depth)
loadAll in interface Capability.LoadByIdspublic <T> Collection<T> loadAll(Collection<T> objects)
loadAll in interface Capability.LoadByInstancespublic <T> Collection<T> loadAll(Collection<T> objects, int depth)
loadAll in interface Capability.LoadByInstancespublic <T> Collection<T> loadAll(Collection<T> objects, SortOrder sortOrder)
loadAll in interface Capability.LoadByInstancespublic <T> Collection<T> loadAll(Collection<T> objects, SortOrder sortOrder, int depth)
loadAll in interface Capability.LoadByInstancespublic <T> Collection<T> loadAll(Collection<T> objects, Pagination pagination)
loadAll in interface Capability.LoadByInstancespublic <T> Collection<T> loadAll(Collection<T> objects, Pagination pagination, int depth)
loadAll in interface Capability.LoadByInstancespublic <T> Collection<T> loadAll(Collection<T> objects, SortOrder sortOrder, Pagination pagination)
loadAll in interface Capability.LoadByInstancespublic <T> Collection<T> loadAll(Collection<T> objects, SortOrder sortOrder, Pagination pagination, int depth)
loadAll in interface Capability.LoadByInstancespublic <T> T queryForObject(Class<T> type, String cypher, Map<String,?> parameters)
Capability.ExecuteQueriesqueryForObject in interface Capability.ExecuteQueriesT - A domain object or scalar.type - The type that should be returned from the query.cypher - The parametrizable cypher to execute.parameters - Any scalar parameters to attach to the cypher.public <T> Iterable<T> query(Class<T> type, String cypher, Map<String,?> parameters)
Capability.ExecuteQueriesquery in interface Capability.ExecuteQueriesT - A domain object or scalar.type - The type that should be returned from the query.cypher - The parametrizable cypher to execute.parameters - Any parameters to attach to the cypher.public Result query(String cypher, Map<String,?> parameters)
Capability.ExecuteQueriesquery in interface Capability.ExecuteQueriescypher - The parametrisable cypher to execute.parameters - Any parameters to attach to the cypher.Result containing an Iterable map representing query results and QueryStatistics if applicable.public Result query(String cypher, Map<String,?> parameters, boolean readOnly)
Capability.ExecuteQueriesquery in interface Capability.ExecuteQueriescypher - The parametrisable cypher to execute.parameters - Any parameters to attach to the cypher.readOnly - true if the query is readOnly, false otherwiseResult of Iterables with each entry representing a neo4j object's properties.public long countEntitiesOfType(Class<?> entity)
Capability.ExecuteQueriescountEntitiesOfType in interface Capability.ExecuteQueriesentity - The Class denoting the type of entity to countpublic long count(Class<?> clazz, Iterable<Filter> filters)
Capability.ExecuteQueriescount in interface Capability.ExecuteQueriesclazz - The Class denoting the type of entity to countfilters - a collection of Filter objects used as additional parameters to the querypublic void purgeDatabase()
purgeDatabase in interface Capability.Deletepublic void clear()
clear in interface Capability.Deletepublic <T> void delete(T object)
delete in interface Capability.Deletepublic <T> void deleteAll(Class<T> type)
deleteAll in interface Capability.Deletepublic <T> Object delete(Class<T> type, Iterable<Filter> filters, boolean listResults)
delete in interface Capability.Deletepublic <T> void save(T object)
save in interface Capability.Savepublic <T> void save(T object,
int depth)
save in interface Capability.Savepublic Transaction beginTransaction()
Capability.TransactionsbeginTransaction in interface Capability.Transactionspublic Transaction beginTransaction(Transaction.Type type)
Capability.TransactionsbeginTransaction in interface Capability.Transactionstype - the Transaction.Type required for this transaction@Deprecated public <T> T doInTransaction(GraphCallback<T> graphCallback)
Capability.TransactionsGraphCallback in the scope of this Session, giving fine-grained control over
behaviour.doInTransaction in interface Capability.TransactionsT - The type of object returned from applying this callbackgraphCallback - The GraphCallback to executeGraphCallbackpublic Transaction getTransaction()
Capability.TransactionsgetTransaction in interface Capability.Transactionspublic Long resolveGraphIdFor(Object possibleEntity)
Capability.GraphIdresolveGraphIdFor in interface Capability.GraphIdpossibleEntity - the possible entityCapability.GraphId or null if either the object is not an entity or the id is null.public boolean detachNodeEntity(Long id)
detachNodeEntity in interface Capability.GraphIdpublic boolean detachRelationshipEntity(Long id)
detachRelationshipEntity in interface Capability.GraphIdpublic <T,ID extends Serializable> QueryStatements<ID> queryStatementsFor(Class<T> type)
public MappingContext context()
public MetaData metaData()
public void setDriver(Driver driver)
public Request requestHandler()
public DefaultTransactionManager transactionManager()
public void info(String msg)
public void warn(String msg)
public void debug(String msg)
public void resolvePropertyAnnotations(Class entityType, Iterable<Filter> filters)
public void resolvePropertyAnnotations(Class entityType, SortOrder sortOrder)
public String getLastBookmark()
SessiongetLastBookmark in interface Sessionpublic void withBookmark(String bookmark)
SessionwithBookmark in interface Sessionbookmark - The last used bookmark String that this session should start from.Copyright © 2016 Neo Technology, Inc.. All rights reserved.