| Constructor and Description |
|---|
Neo4jSession(MetaData metaData,
Driver driver) |
Neo4jSession(MetaData metaData,
Driver driver,
List<EventListener> eventListeners,
LoadStrategy loadStrategy) |
| 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).
|
Transaction |
beginTransaction(Transaction.Type type,
Iterable<String> bookmarks)
Begin a new transaction, passing in the required type and bookmarks
If an existing transaction already exists, users must
decide whether to commit or rollback.
|
void |
clear()
Clears the Session
|
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)
Delete all entities of type matching filter
|
<T> void |
delete(T object)
Delete entity (or entities)
|
<T> void |
deleteAll(Class<T> type)
Delete all entities of type
|
boolean |
detachNodeEntity(Long id)
Detach this node entity represented by the supplied Graph ID from the session.
|
boolean |
detachRelationshipEntity(Long id)
Detach this relationship entity represented by the supplied Graph ID from the session.
|
boolean |
dispose(EventListener eventListener)
Remove an event listener from this session.
|
<T> T |
doInTransaction(GraphCallback<T> graphCallback)
Deprecated.
|
<T> T |
doInTransaction(TransactionalUnitOfWork<T> function,
Transaction.Type txType)
For internal use only.
|
void |
doInTransaction(TransactionalUnitOfWorkWithoutResult function,
Transaction.Type txType) |
String |
entityType(String name) |
boolean |
eventsEnabled()
Determines if events are enabled for this session.
|
String |
getLastBookmark()
Retrieves the last bookmark used in this session when used in a Neo4j Causal Cluster.
|
LoadStrategy |
getLoadStrategy()
Returns current load strategy
|
Transaction |
getTransaction()
Get the existing transaction if available
|
<T,ID extends Serializable> |
load(Class<T> type,
ID id)
Load single entity instance of type, with default depth = 1
|
<T,ID extends Serializable> |
load(Class<T> type,
ID id,
int depth)
Load single entity instance of type, with depth
|
<T> Collection<T> |
loadAll(Class<T> type)
Load all entities of type, with default depth = 1.
|
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids)
Load entities of type by their ids, with default depth = 1.
|
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
int depth)
Load entities of type by their ids.
|
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
Pagination paging)
Load entities of type by their ids, with default depth = 1.
|
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
Pagination paging,
int depth)
Load entities of type by their ids.
|
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
SortOrder sortOrder)
Load entities of type by their ids, with default depth = 1.
|
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
SortOrder sortOrder,
int depth)
Load entities of type by their ids.
|
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
SortOrder sortOrder,
Pagination pagination)
Load entities of type by their ids, with default depth = 1.
|
<T,ID extends Serializable> |
loadAll(Class<T> type,
Collection<ID> ids,
SortOrder sortOrder,
Pagination pagination,
int depth)
Load entities of type by their ids.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter)
Load all entities of type, filtered by filter, with default depth = 1.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
int depth)
Load all entities of type, filtered by filter.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
Pagination pagination)
Load all entities of type, filtered by filter, with default depth = 1.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
Pagination pagination,
int depth)
Load all entities of type, filtered by filter.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters)
Load all entities of type, filtered by filters, with default depth = 1.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
int depth)
Load all entities of type, filtered by filters.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
SortOrder sortOrder)
Load all entities of type, filtered by filter, with default depth = 1.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
SortOrder sortOrder,
int depth)
Load all entities of type, filtered by filter.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
SortOrder sortOrder,
Pagination pagination)
Load all entities of type, filtered by filter, with default depth = 1.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filter filter,
SortOrder sortOrder,
Pagination pagination,
int depth)
Load all entities of type, filtered by filter.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
Pagination pagination)
Load all entities of type, filtered by filters, with default depth = 1.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
Pagination pagination,
int depth)
Load all entities of type, filtered by filters.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
SortOrder sortOrder)
Load all entities of type, filtered by filters, with default depth = 1.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
SortOrder sortOrder,
int depth)
Load all entities of type, filtered by filters.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
SortOrder sortOrder,
Pagination pagination)
Load all entities of type, filtered by filters, with default depth = 1.
|
<T> Collection<T> |
loadAll(Class<T> type,
Filters filters,
SortOrder sortOrder,
Pagination pagination,
int depth)
Load all entities of type, filtered by filters.
|
<T> Collection<T> |
loadAll(Class<T> type,
int depth)
Load all entities of type, with depth
|
<T> Collection<T> |
loadAll(Class<T> type,
Pagination paging)
Load all entities of type, with default depth = 1.
|
<T> Collection<T> |
loadAll(Class<T> type,
Pagination paging,
int depth)
Load all entities of type.
|
<T> Collection<T> |
loadAll(Class<T> type,
SortOrder sortOrder)
Load all entities of type, with default depth = 1
|
<T> Collection<T> |
loadAll(Class<T> type,
SortOrder sortOrder,
int depth)
Load all entities of type.
|
<T> Collection<T> |
loadAll(Class<T> type,
SortOrder sortOrder,
Pagination pagination)
Load all entities of type, with default depth = 1.
|
<T> Collection<T> |
loadAll(Class<T> type,
SortOrder sortOrder,
Pagination pagination,
int depth)
Load all entities of type.
|
<T> Collection<T> |
loadAll(Collection<T> objects)
Load entities by themselves - uses id of the entity to load it again, with default depth = 1.
|
<T> Collection<T> |
loadAll(Collection<T> objects,
int depth)
Load entities by themselves - uses id of the entity to load it again.
|
<T> Collection<T> |
loadAll(Collection<T> objects,
Pagination pagination)
Load entities by themselves - uses id of the entity to load it again, with default depth = 1.
|
<T> Collection<T> |
loadAll(Collection<T> objects,
Pagination pagination,
int depth)
Load entities by themselves - uses id of the entity to load it again.
|
<T> Collection<T> |
loadAll(Collection<T> objects,
SortOrder sortOrder)
Load entities by themselves - uses id of the entity to load it again, with default depth = 1.
|
<T> Collection<T> |
loadAll(Collection<T> objects,
SortOrder sortOrder,
int depth)
Load entities by themselves - uses id of the entity to load it again.
|
<T> Collection<T> |
loadAll(Collection<T> objects,
SortOrder sortOrder,
Pagination pagination)
Load entities by themselves - uses id of the entity to load it again, with default depth = 1.
|
<T> Collection<T> |
loadAll(Collection<T> objects,
SortOrder sortOrder,
Pagination pagination,
int depth)
Load entities by themselves - uses id of the entity to load it again.
|
MetaData |
metaData() |
void |
notifyListeners(Event event)
Notifies listeners of this session of the supplied
Event. |
void |
purgeDatabase()
Delete all nodes in the database.
|
<T> Iterable<T> |
query(Class<T> type,
String cypher,
Map<String,?> parameters)
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)
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)
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)
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,
int depth) |
EventListener |
register(EventListener eventListener)
Register an event listener with this session.
|
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)
Save entity(or entities) into the database, up to specified depth
The entities are either created or updated.
|
<T> void |
save(T object,
int depth)
Save entity(or entities) into the database, up to specified depth
The objects are either created or updated.
|
void |
setDriver(Driver driver)
Deprecated.
|
void |
setLoadStrategy(LoadStrategy loadStrategy)
Sets the LoadStrategy
Will be used for all subsequent queries.
|
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, LoadStrategy loadStrategy)
public EventListener register(EventListener eventListener)
Sessionpublic void notifyListeners(Event event)
SessionEvent.notifyListeners in interface Sessionevent - The event to inform listeners with.public boolean eventsEnabled()
SessioneventsEnabled in interface Sessiontrue if this session allows events.public boolean dispose(EventListener eventListener)
Sessionpublic <T,ID extends Serializable> T load(Class<T> type, ID id)
Sessionpublic <T,ID extends Serializable> T load(Class<T> type, ID id, int depth)
Sessionpublic <T> Collection<T> loadAll(Class<T> type)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, int depth)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Pagination paging)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Pagination paging, int depth)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, SortOrder sortOrder)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, SortOrder sortOrder, int depth)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, SortOrder sortOrder, Pagination pagination)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, SortOrder sortOrder, Pagination pagination, int depth)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filter filter)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filter filter, int depth)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filter filter, SortOrder sortOrder)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filter filter, SortOrder sortOrder, int depth)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filter filter, Pagination pagination)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filter filter, Pagination pagination, int depth)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filter filter, SortOrder sortOrder, Pagination pagination)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filter filter, SortOrder sortOrder, Pagination pagination, int depth)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filters filters)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filters filters, int depth)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filters filters, SortOrder sortOrder)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filters filters, SortOrder sortOrder, int depth)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filters filters, Pagination pagination)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filters filters, Pagination pagination, int depth)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filters filters, SortOrder sortOrder, Pagination pagination)
Sessionpublic <T> Collection<T> loadAll(Class<T> type, Filters filters, SortOrder sortOrder, Pagination pagination, int depth)
Sessionpublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids)
Sessionpublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, int depth)
Sessionpublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, SortOrder sortOrder)
Sessionpublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, SortOrder sortOrder, int depth)
Sessionpublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, Pagination paging)
Sessionpublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, Pagination paging, int depth)
Sessionpublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, SortOrder sortOrder, Pagination pagination)
Sessionpublic <T,ID extends Serializable> Collection<T> loadAll(Class<T> type, Collection<ID> ids, SortOrder sortOrder, Pagination pagination, int depth)
Sessionpublic <T> Collection<T> loadAll(Collection<T> objects)
Sessionpublic <T> Collection<T> loadAll(Collection<T> objects, int depth)
Sessionpublic <T> Collection<T> loadAll(Collection<T> objects, SortOrder sortOrder)
Sessionpublic <T> Collection<T> loadAll(Collection<T> objects, SortOrder sortOrder, int depth)
Sessionpublic <T> Collection<T> loadAll(Collection<T> objects, Pagination pagination)
Sessionpublic <T> Collection<T> loadAll(Collection<T> objects, Pagination pagination, int depth)
Sessionpublic <T> Collection<T> loadAll(Collection<T> objects, SortOrder sortOrder, Pagination pagination)
Sessionpublic <T> Collection<T> loadAll(Collection<T> objects, SortOrder sortOrder, Pagination pagination, int depth)
Sessionpublic <T> T queryForObject(Class<T> type, String cypher, Map<String,?> parameters)
SessionqueryForObject in interface SessionT - 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)
Sessionquery in interface SessionT - 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)
Sessionquery in interface Sessioncypher - 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)
Sessionpublic long countEntitiesOfType(Class<?> entity)
SessioncountEntitiesOfType in interface Sessionentity - The Class denoting the type of entity to countpublic long count(Class<?> clazz, Iterable<Filter> filters)
Sessionpublic void purgeDatabase()
SessionpurgeDatabase in interface Sessionpublic void clear()
Sessionpublic <T> void delete(T object)
Sessionpublic <T> void deleteAll(Class<T> type)
Sessionpublic <T> Object delete(Class<T> type, Iterable<Filter> filters, boolean listResults)
Sessionpublic <T> void save(T object)
Sessionpublic <T> void save(T object,
int depth)
Sessionpublic Transaction beginTransaction()
SessionbeginTransaction in interface Sessionpublic Transaction beginTransaction(Transaction.Type type)
SessionbeginTransaction in interface Sessiontype - the Transaction.Type required for this transactionpublic Transaction beginTransaction(Transaction.Type type, Iterable<String> bookmarks)
SessionbeginTransaction in interface Sessiontype - the Transaction.Type required for this transactionbookmarks - bookmarks that are passed to driver@Deprecated public <T> T doInTransaction(GraphCallback<T> graphCallback)
SessionGraphCallback in the scope of this Session, giving fine-grained control over
behaviour.doInTransaction in interface SessionT - The type of object returned from applying this callbackgraphCallback - The GraphCallback to executeGraphCallbackpublic void doInTransaction(TransactionalUnitOfWorkWithoutResult function, Transaction.Type txType)
function - The code to execute.txType - Transaction type, readonly or not.doInTransaction(TransactionalUnitOfWork, org.neo4j.ogm.transaction.Transaction.Type)public <T> T doInTransaction(TransactionalUnitOfWork<T> function, Transaction.Type txType)
T - The result type.function - The callback to execute.txType - Transaction type, readonly or not.public Transaction getTransaction()
SessiongetTransaction in interface Sessionpublic Long resolveGraphIdFor(Object possibleEntity)
SessionresolveGraphIdFor in interface SessionpossibleEntity - the possible entityGraphId or null if either the object is not an entity or the id is null.public boolean detachNodeEntity(Long id)
SessiondetachNodeEntity in interface Sessionid - the node id to detach.true if detached successfully.public boolean detachRelationshipEntity(Long id)
SessiondetachRelationshipEntity in interface Sessionid - the relationship id to detach.true if detached successfully.public <T,ID extends Serializable> QueryStatements<ID> queryStatementsFor(Class<T> type, int depth)
public MappingContext context()
public MetaData metaData()
@Deprecated public void setDriver(Driver driver)
public Request requestHandler()
public DefaultTransactionManager transactionManager()
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.public LoadStrategy getLoadStrategy()
SessiongetLoadStrategy in interface Sessionpublic void setLoadStrategy(LoadStrategy loadStrategy)
SessionsetLoadStrategy in interface SessionCopyright © 2018 Neo Technology, Inc.. All rights reserved.