Spring Data JPA

org.springframework.data.jpa.repository
Interface JpaRepository<T,ID extends Serializable>

All Superinterfaces:
CrudRepository<T,ID>, PagingAndSortingRepository<T,ID>, Repository<T,ID>
All Known Implementing Classes:
QueryDslJpaRepository, SimpleJpaRepository

@NoRepositoryBean
public interface JpaRepository<T,ID extends Serializable>
extends PagingAndSortingRepository<T,ID>

JPA specific extension of Repository.

Author:
Oliver Gierke

Method Summary
 void deleteAllInBatch()
          Deletes all entites in a batch call.
 void deleteInBatch(Iterable<T> entities)
          Deletes the given entities in a batch which means it will create a single Query.
 List<T> findAll()
           
 List<T> findAll(Iterable<ID> ids)
           
 List<T> findAll(Sort sort)
           
 void flush()
          Flushes all pending changes to the database.
 T getOne(ID id)
          Returns a reference to the entity with the given identifier.
<S extends T>
List<S>
save(Iterable<S> entities)
           
<S extends T>
S
saveAndFlush(S entity)
          Saves an entity and flushes changes instantly.
 
Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAll
 
Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, delete, delete, deleteAll, exists, findOne, save
 

Method Detail

findAll

List<T> findAll()
Specified by:
findAll in interface CrudRepository<T,ID extends Serializable>

findAll

List<T> findAll(Sort sort)
Specified by:
findAll in interface PagingAndSortingRepository<T,ID extends Serializable>

findAll

List<T> findAll(Iterable<ID> ids)
Specified by:
findAll in interface CrudRepository<T,ID extends Serializable>

save

<S extends T> List<S> save(Iterable<S> entities)
Specified by:
save in interface CrudRepository<T,ID extends Serializable>

flush

void flush()
Flushes all pending changes to the database.


saveAndFlush

<S extends T> S saveAndFlush(S entity)
Saves an entity and flushes changes instantly.

Parameters:
entity -
Returns:
the saved entity

deleteInBatch

void deleteInBatch(Iterable<T> entities)
Deletes the given entities in a batch which means it will create a single Query. Assume that we will clear the EntityManager after the call.

Parameters:
entities -

deleteAllInBatch

void deleteAllInBatch()
Deletes all entites in a batch call.


getOne

T getOne(ID id)
Returns a reference to the entity with the given identifier.

Parameters:
id - must not be null.
Returns:
a reference to the entity with the given identifier.
See Also:
EntityManager.getReference(Class, Object)

Spring Data JPA

Copyright © 2011-2014-2014 Pivotal Software, Inc.. All Rights Reserved.