|
Spring Data Jpa | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.data.repository.support.RepositorySupport<T,ID> org.springframework.data.jpa.repository.support.JpaRepositorySupport<T,ID> org.springframework.data.jpa.repository.support.SimpleJpaRepository<T,ID>
T
- the type of the entity to handleID
- the type of the entity's identifier@Repository public class SimpleJpaRepository<T,ID extends Serializable>
Default implementation of the Repository
interface. This will offer
you a more sophisticated interface than the plain EntityManager
.
Constructor Summary | |
---|---|
SimpleJpaRepository(Class<T> domainClass,
javax.persistence.EntityManager entityManager)
Creates a new SimpleJpaRepository to manage objects of the given
domain type. |
Method Summary | ||
---|---|---|
Long |
count()
|
|
static
|
create(Class<T> domainClass,
javax.persistence.EntityManager entityManager)
Factory method to create SimpleJpaRepository instances. |
|
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()
|
|
org.springframework.data.domain.Page<T> |
findAll(org.springframework.data.domain.Pageable pageable)
|
|
List<T> |
findAll(org.springframework.data.domain.Sort sort)
|
|
List<T> |
findAll(Specification<T> spec)
Returns all entities matching the given Specification . |
|
org.springframework.data.domain.Page<T> |
findAll(Specification<T> spec,
org.springframework.data.domain.Pageable pageable)
Returns a Page of entities matching the given
Specification . |
|
T |
findById(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 org.springframework.data.jpa.repository.support.JpaRepositorySupport |
---|
createIsNewStrategy |
Methods inherited from class org.springframework.data.repository.support.RepositorySupport |
---|
getDomainClass, getIsNewStrategy |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleJpaRepository(Class<T> domainClass, javax.persistence.EntityManager entityManager)
SimpleJpaRepository
to manage objects of the given
domain type.
domainClass
- entityManager
- Method Detail |
---|
public static <T,ID extends Serializable> org.springframework.data.repository.Repository<T,ID> create(Class<T> domainClass, javax.persistence.EntityManager entityManager)
SimpleJpaRepository
instances.
T
- the type of the entity to handleID
- the type of the entity's identifierdomainClass
- the domain class to handleentityManager
- the EntityManager
backing the repository
public void delete(T entity)
public void delete(Iterable<? extends T> entities)
public void deleteInBatch(Iterable<T> entities)
JpaRepository
Query
. Assume that we will clear the EntityManager
after
the call.
public void deleteAll()
public T findById(ID id)
public boolean exists(ID id)
public List<T> findAll()
public List<T> findAll(org.springframework.data.domain.Sort sort)
public org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable)
public T findOne(Specification<T> spec)
JpaRepository
Specification
.
public List<T> findAll(Specification<T> spec)
JpaRepository
Specification
.
public org.springframework.data.domain.Page<T> findAll(Specification<T> spec, org.springframework.data.domain.Pageable pageable)
JpaRepository
Page
of entities matching the given
Specification
.
public Long count()
public T save(T entity)
public T saveAndFlush(T entity)
JpaRepository
public List<T> save(Iterable<? extends T> entities)
public void flush()
JpaRepository
|
Spring Data Jpa | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |