| Constructor and Description |
|---|
Neo4jSession(MetaData metaData,
boolean useStrictQuerying,
Driver driver) |
Neo4jSession(MetaData metaData,
boolean useStrictQuerying,
Driver driver,
List<EventListener> eventListeners,
LoadStrategy loadStrategy,
EntityInstantiator entityInstantiator) |
| Modifier and Type | Method and Description |
|---|---|
void |
addWriteProtection(WriteProtectionTarget target,
Predicate<Object> protection)
|
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.
|
<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.
|
Optional<String> |
determineLabelsOrTypeForLoading(Class<?> type)
Determines the one relationship type or maybe multiple labels to use in various statements during loading of things.
|
boolean |
dispose(EventListener eventListener)
Remove an event listener from this session.
|
<T> T |
doInTransaction(TransactionalUnitOfWork<T> function,
boolean forceTx,
Transaction.Type txType)
For internal use only.
|
<T> T |
doInTransaction(TransactionalUnitOfWork<T> function,
Transaction.Type txType) |
void |
doInTransaction(TransactionalUnitOfWorkWithoutResult function,
boolean forceTx,
Transaction.Type txType) |
void |
doInTransaction(TransactionalUnitOfWorkWithoutResult function,
Transaction.Type txType) |
boolean |
eventsEnabled()
Determines if events are enabled for this session.
|
EntityInstantiator |
getEntityInstantiator() |
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. |
OptimisticLockingChecker |
optimisticLockingChecker() |
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.
|
void |
removeWriteProtection(WriteProtectionTarget target)
Removes write protection for the specified mode.
|
Request |
requestHandler() |
Long |
resolveGraphIdFor(Object possibleEntity)
Resolve the graph id for a possible entity.
|
<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 |
setLoadStrategy(LoadStrategy loadStrategy)
Sets the LoadStrategy
Will be used for all subsequent queries.
|
void |
setWriteProtectionStrategy(WriteProtectionStrategy writeProtectionStrategy)
Can be used to apply a completely custom write protection strategy.
|
void |
warn(String msg) |
void |
withBookmark(String bookmark)
Sets the bookmark to use on this session.
|
public Neo4jSession(MetaData metaData, boolean useStrictQuerying, Driver driver, List<EventListener> eventListeners, LoadStrategy loadStrategy, EntityInstantiator entityInstantiator)
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 parameterizable 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 parameterizable cypher to execute.parameters - Any parameters to attach to the cypher.public Result query(String cypher, Map<String,?> parameters)
Sessionquery in interface Sessioncypher - The parameterisable 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)
Sessionquery in interface Sessioncypher - The parameterisable 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)
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 <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)
SessionId
using the internal Id-generation-strategy, those fields are modified and set to the internal graph-id.public <T> void save(T object,
int depth)
SessionId
using the internal Id-generation-strategy, those fields are modified and set to the internal graph-id.public void addWriteProtection(WriteProtectionTarget target, Predicate<Object> protection)
Predicate as possible write protection for the specified target. OGM will
pass the entity that currently is persisted to the predicate and will skip writing or updating it (depending on
the mode) when the predicate returns true.
setWriteProtectionStrategy(WriteProtectionStrategy) has been used to apply a custom strategy, is has
to be used with null again to remove the custom write protection strategy before applying the simple
one here.target - The target to which the write protection should be appliedprotection - A predicate determines per entity if write protection has to be applied or node.public void removeWriteProtection(WriteProtectionTarget target)
target - The target to remove all write protections for.public void setWriteProtectionStrategy(WriteProtectionStrategy writeProtectionStrategy)
writeProtectionStrategy - public 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 driverpublic 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 void doInTransaction(TransactionalUnitOfWorkWithoutResult function, boolean forceTx, Transaction.Type txType)
public <T> T doInTransaction(TransactionalUnitOfWork<T> function, Transaction.Type txType)
public <T> T doInTransaction(TransactionalUnitOfWork<T> function, boolean forceTx, 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 entitypublic 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 Optional<String> determineLabelsOrTypeForLoading(Class<?> type)
Multiple labels are pre-joined with
`:`. There are meant to be passed to various clause builders, which cannot deal with list of labels, but use the one label or type and use it in between tickmarks.
type - The type of the objects that shall be loadedpublic MappingContext context()
public OptimisticLockingChecker optimisticLockingChecker()
public MetaData metaData()
public void clear()
Sessionpublic Request requestHandler()
public void warn(String msg)
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 EntityInstantiator getEntityInstantiator()
public void setLoadStrategy(LoadStrategy loadStrategy)
SessionsetLoadStrategy in interface SessionCopyright © 2015–2020 Neo Technology, Inc.. All rights reserved.