|
Spring Data Jpa | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.data.jpa.repository.support.SimpleJpaRepository<T,ID>
T - the type of the entity to handleID - the type of the entity's identifier@Repository @Transactional(readOnly=true) public class SimpleJpaRepository<T,ID extends Serializable>
Default implementation of the CrudRepository interface. This will offer you a more sophisticated interface
than the plain EntityManager .
| Constructor Summary | |
|---|---|
SimpleJpaRepository(Class<T> domainClass,
javax.persistence.EntityManager em)
Creates a new SimpleJpaRepository to manage objects of the given domain type. |
|
SimpleJpaRepository(JpaEntityInformation<T,?> entityInformation,
javax.persistence.EntityManager entityManager)
Creates a new SimpleJpaRepository to manage objects of the given JpaEntityInformation. |
|
| Method Summary | |
|---|---|
long |
count()
|
long |
count(Specification<T> spec)
Returns the number of instances that the given Specification will return. |
void |
delete(ID id)
|
void |
delete(Iterable<? extends T> entities)
|
void |
delete(T entity)
|
void |
deleteAll()
|
void |
deleteInBatch(Iterable<T> entities)
Deletes the given entities in a batch which means it will create a single Query. |
boolean |
exists(ID id)
|
List<T> |
findAll()
|
Page<T> |
findAll(Pageable pageable)
|
List<T> |
findAll(Sort sort)
|
List<T> |
findAll(Specification<T> spec)
Returns all entities matching the given Specification. |
Page<T> |
findAll(Specification<T> spec,
Pageable pageable)
Returns a Page of entities matching the given Specification. |
List<T> |
findAll(Specification<T> spec,
Sort sort)
Returns all entities matching the given Specification and Sort. |
T |
findOne(ID id)
|
T |
findOne(Specification<T> spec)
Returns a single entity matching the given Specification. |
void |
flush()
Flushes all pending changes to the database. |
List<T> |
save(Iterable<? extends T> entities)
|
T |
save(T entity)
|
T |
saveAndFlush(T entity)
Saves an entity and flushes changes instantly. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleJpaRepository(JpaEntityInformation<T,?> entityInformation,
javax.persistence.EntityManager entityManager)
SimpleJpaRepository to manage objects of the given JpaEntityInformation.
entityInformation - entityManager -
public SimpleJpaRepository(Class<T> domainClass,
javax.persistence.EntityManager em)
SimpleJpaRepository to manage objects of the given domain type.
domainClass - em - | Method Detail |
|---|
@Transactional public void delete(ID id)
delete in interface CrudRepository<T,ID extends Serializable>@Transactional public void delete(T entity)
delete in interface CrudRepository<T,ID extends Serializable>@Transactional public void delete(Iterable<? extends T> entities)
delete in interface CrudRepository<T,ID extends Serializable>@Transactional public void deleteInBatch(Iterable<T> entities)
JpaRepositoryQuery. Assume that we will clear
the EntityManager after the call.
deleteInBatch in interface JpaRepository<T,ID extends Serializable>@Transactional public void deleteAll()
deleteAll in interface CrudRepository<T,ID extends Serializable>public T findOne(ID id)
findOne in interface CrudRepository<T,ID extends Serializable>public boolean exists(ID id)
exists in interface CrudRepository<T,ID extends Serializable>public List<T> findAll()
findAll in interface JpaRepository<T,ID extends Serializable>findAll in interface CrudRepository<T,ID extends Serializable>public List<T> findAll(Sort sort)
findAll in interface JpaRepository<T,ID extends Serializable>findAll in interface PagingAndSortingRepository<T,ID extends Serializable>public Page<T> findAll(Pageable pageable)
findAll in interface PagingAndSortingRepository<T,ID extends Serializable>public T findOne(Specification<T> spec)
JpaSpecificationExecutorSpecification.
findOne in interface JpaSpecificationExecutor<T>public List<T> findAll(Specification<T> spec)
JpaSpecificationExecutorSpecification.
findAll in interface JpaSpecificationExecutor<T>
public Page<T> findAll(Specification<T> spec,
Pageable pageable)
JpaSpecificationExecutorPage of entities matching the given Specification.
findAll in interface JpaSpecificationExecutor<T>
public List<T> findAll(Specification<T> spec,
Sort sort)
JpaSpecificationExecutorSpecification and Sort.
findAll in interface JpaSpecificationExecutor<T>public long count()
count in interface CrudRepository<T,ID extends Serializable>public long count(Specification<T> spec)
JpaSpecificationExecutorSpecification will return.
count in interface JpaSpecificationExecutor<T>spec - the Specification to count instances for
@Transactional public T save(T entity)
save in interface CrudRepository<T,ID extends Serializable>@Transactional public T saveAndFlush(T entity)
JpaRepository
saveAndFlush in interface JpaRepository<T,ID extends Serializable>@Transactional public List<T> save(Iterable<? extends T> entities)
save in interface JpaRepository<T,ID extends Serializable>save in interface CrudRepository<T,ID extends Serializable>@Transactional public void flush()
JpaRepository
flush in interface JpaRepository<T,ID extends Serializable>
|
Spring Data Jpa | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||