Spring Data Graph

org.springframework.data.neo4j.repository
Interface CRUDRepository<T extends GraphBacked<?>>

All Superinterfaces:
org.springframework.data.repository.CrudRepository<T,Long>, org.springframework.data.repository.PagingAndSortingRepository<T,Long>, org.springframework.data.repository.Repository<T,Long>
All Known Subinterfaces:
GraphRepository<T>
All Known Implementing Classes:
AbstractGraphRepository, NodeGraphRepository, RelationshipGraphRepository

@NoRepositoryBean
public interface CRUDRepository<T extends GraphBacked<?>>
extends org.springframework.data.repository.PagingAndSortingRepository<T,Long>

CRUD interface for graph repositories, used as base repository for crud operations


Method Summary
 long count()
          uses the configured TypeRepresentationStrategy, depending on the strategy this number might be an approximation
 void delete(Iterable<? extends T> entities)
          deletes the given entities by calling their entity.remove() methods
 void delete(T entity)
          deletes the given entity by calling its entity.remove() method
 void deleteAll()
          removes all entities of this type, use with care
 boolean exists(Long id)
           
 org.neo4j.helpers.collection.ClosableIterable<T> findAll()
          uses the configured TypeRepresentationStrategy to load all entities, might return a large result
 org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable)
          finder that takes the provided sorting and paging into account NOTE: the sorting is not yet implemented
 org.neo4j.helpers.collection.ClosableIterable<T> findAll(org.springframework.data.domain.Sort sort)
          finder that takes the provided sorting into account NOTE: the sorting is not yet implemented
 T findOne(Long id)
           
 Iterable<T> save(Iterable<? extends T> entities)
          persists the provided entities by forwarding to their entity.persist() methods
 T save(T entity)
          persists an entity by forwarding to entity.persist()
 
Methods inherited from interface org.springframework.data.repository.CrudRepository
delete
 

Method Detail

save

@Transactional
T save(T entity)
persists an entity by forwarding to entity.persist()

Specified by:
save in interface org.springframework.data.repository.CrudRepository<T extends GraphBacked<?>,Long>
Parameters:
entity - to be persisted
Returns:
the saved entity (being the same reference as the parameter)

save

@Transactional
Iterable<T> save(Iterable<? extends T> entities)
persists the provided entities by forwarding to their entity.persist() methods

Specified by:
save in interface org.springframework.data.repository.CrudRepository<T extends GraphBacked<?>,Long>
Parameters:
entities - to be persisted
Returns:
the input iterable

findOne

T findOne(Long id)
Specified by:
findOne in interface org.springframework.data.repository.CrudRepository<T extends GraphBacked<?>,Long>
Parameters:
id - of the node or relationship-entity
Returns:
found instance or null

exists

boolean exists(Long id)
Specified by:
exists in interface org.springframework.data.repository.CrudRepository<T extends GraphBacked<?>,Long>
Parameters:
id -
Returns:
true if the entity with this id exists

findAll

org.neo4j.helpers.collection.ClosableIterable<T> findAll()
uses the configured TypeRepresentationStrategy to load all entities, might return a large result

Specified by:
findAll in interface org.springframework.data.repository.CrudRepository<T extends GraphBacked<?>,Long>
Returns:
all entities of the given type NOTE: please close the iterable if it is not fully looped through

count

long count()
uses the configured TypeRepresentationStrategy, depending on the strategy this number might be an approximation

Specified by:
count in interface org.springframework.data.repository.CrudRepository<T extends GraphBacked<?>,Long>
Returns:
number of entities of this type in the graph

delete

@Transactional
void delete(T entity)
deletes the given entity by calling its entity.remove() method

Specified by:
delete in interface org.springframework.data.repository.CrudRepository<T extends GraphBacked<?>,Long>
Parameters:
entity - to delete

delete

@Transactional
void delete(Iterable<? extends T> entities)
deletes the given entities by calling their entity.remove() methods

Specified by:
delete in interface org.springframework.data.repository.CrudRepository<T extends GraphBacked<?>,Long>
Parameters:
entities - to delete

deleteAll

@Transactional
void deleteAll()
removes all entities of this type, use with care

Specified by:
deleteAll in interface org.springframework.data.repository.CrudRepository<T extends GraphBacked<?>,Long>

findAll

org.neo4j.helpers.collection.ClosableIterable<T> findAll(org.springframework.data.domain.Sort sort)
finder that takes the provided sorting into account NOTE: the sorting is not yet implemented

Specified by:
findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T extends GraphBacked<?>,Long>
Parameters:
sort -
Returns:
all elements of the repository type, sorted according to the sort NOTE: please close the iterable if it is not fully looped through

findAll

org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable)
finder that takes the provided sorting and paging into account NOTE: the sorting is not yet implemented

Specified by:
findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T extends GraphBacked<?>,Long>
Parameters:
pageable -
Returns:
all elements of the repository type, sorted according to the sort NOTE: please close the iterable if it is not fully looped through

Spring Data Graph

Copyright © 2011 SpringSource. All Rights Reserved.