public interface CrudService<T,ID extends java.io.Serializable>
| 限定符和类型 | 方法和说明 |
|---|---|
long |
count()
Returns the number of entities available.
|
long |
count(org.springframework.data.jpa.domain.Specification<T> spec)
Returns the number of instances that the given
Specification will return. |
void |
delete(ID id)
Deletes the entity with the given id.
|
void |
delete(ID[] ids) |
void |
delete(ID[] ids,
boolean isPhysical) |
void |
delete(ID id,
boolean isPhysical)
Deletes the entity with the given id.
|
void |
delete(java.lang.Iterable<? extends T> entities)
Deletes the given entities.
|
void |
delete(java.lang.Iterable<? extends T> entities,
boolean isPhysical)
Deletes the given entities.
|
void |
delete(java.util.List<ID> ids) |
void |
delete(java.util.List<ID> ids,
boolean isPhysical) |
void |
delete(T entity)
Deletes a given entity.
|
void |
delete(T entity,
boolean isPhysical)
Deletes a given entity.
|
void |
deleteAll()
Deletes all entities managed by the repository.
|
void |
deleteAll(boolean isPhysical)
Deletes all entities managed by the repository.
|
boolean |
exists(ID id)
Returns whether an entity with the given id exists.
|
java.lang.Iterable<T> |
findAll()
Returns all instances of the type.
|
<S extends T> |
findAll(org.springframework.data.domain.Example<S> example) |
<S extends T> |
findAll(org.springframework.data.domain.Example<S> example,
org.springframework.data.domain.Pageable pageable) |
java.lang.Iterable<T> |
findAll(java.lang.Iterable<ID> ids)
Returns all instances of the type with the given IDs.
|
java.util.List<T> |
findAll(org.springframework.data.jpa.domain.Specification<T> spec)
Returns all entities matching the given
Specification. |
org.springframework.data.domain.Page<T> |
findAll(org.springframework.data.jpa.domain.Specification<T> spec,
org.springframework.data.domain.Pageable pageable)
Returns a
Page of entities matching the given Specification. |
java.util.List<T> |
findAll(org.springframework.data.jpa.domain.Specification<T> spec,
org.springframework.data.domain.Sort sort)
Returns all entities matching the given
Specification and Sort. |
java.util.List<T> |
findAll(T entity) |
java.util.List<T> |
findAll(T entity,
org.springframework.data.domain.ExampleMatcher matcher) |
org.springframework.data.domain.Page<T> |
findAll(T entity,
org.springframework.data.domain.ExampleMatcher matcher,
org.springframework.data.domain.Pageable pageable) |
org.springframework.data.domain.Page<T> |
findAll(T entity,
org.springframework.data.domain.Pageable pageable) |
T |
findOne(ID id)
Retrieves an entity by its id.
|
T |
findOne(org.springframework.data.jpa.domain.Specification<T> spec)
Returns a single entity matching the given
Specification. |
T |
getOne(ID id)
Returns a reference to the entity with the given identifier.
|
org.springframework.data.jpa.domain.Specification<T> |
handleQueryAnnotation(T entity) |
org.springframework.data.jpa.domain.Specification<T> |
handleQueryAnnotation(T entity,
org.springframework.data.domain.ExampleMatcher matcher) |
<S extends T> |
save(java.lang.Iterable<S> entities)
Saves all given entities.
|
<S extends T> |
save(S entity)
Saves a given entity.
|
T |
update(ID id,
T entity)
fetch an entity
|
<S extends T> S save(S entity)
S - Sentity - Jpa Entity<S extends T> java.lang.Iterable<S> save(java.lang.Iterable<S> entities)
S - Sentities - The entitiesjava.lang.IllegalArgumentException - in case the given entity is null.T findOne(ID id)
id - must not be null.java.lang.IllegalArgumentException - if id is nullT getOne(ID id)
id - must not be null.EntityManager.getReference(Class, Object)boolean exists(ID id)
id - must not be null.java.lang.IllegalArgumentException - if id is nulljava.lang.Iterable<T> findAll()
java.lang.Iterable<T> findAll(java.lang.Iterable<ID> ids)
ids - idslong count()
void delete(ID id)
id - must not be null.java.lang.IllegalArgumentException - in case the given id is nullvoid delete(java.util.List<ID> ids)
void delete(ID[] ids)
void delete(T entity)
entity - The entityjava.lang.IllegalArgumentException - in case the given entity is null.void delete(java.lang.Iterable<? extends T> entities)
entities - The entitiesjava.lang.IllegalArgumentException - in case the given Iterable is null.void deleteAll()
<S extends T> java.lang.Iterable<S> findAll(org.springframework.data.domain.Example<S> example)
<S extends T> org.springframework.data.domain.Page<S> findAll(org.springframework.data.domain.Example<S> example, org.springframework.data.domain.Pageable pageable)
void delete(ID id, boolean isPhysical)
id - must not be null.isPhysical - default 'false' when the entity is reparable
and give 'true' for need deleted by physical.
Otherwise it will no use, same as delete(T)java.lang.IllegalArgumentException - in case the given id is nullvoid delete(java.util.List<ID> ids, boolean isPhysical)
void delete(ID[] ids, boolean isPhysical)
void delete(T entity, boolean isPhysical)
entity - entityisPhysical - pyjava.lang.IllegalArgumentException - in case the given entity is null.void delete(java.lang.Iterable<? extends T> entities, boolean isPhysical)
entities - entitiesisPhysical - pyjava.lang.IllegalArgumentException - in case the given Iterable is null.void deleteAll(boolean isPhysical)
isPhysical - pyT findOne(org.springframework.data.jpa.domain.Specification<T> spec)
Specification.spec - specjava.util.List<T> findAll(org.springframework.data.jpa.domain.Specification<T> spec)
Specification.spec - specorg.springframework.data.domain.Page<T> findAll(org.springframework.data.jpa.domain.Specification<T> spec, org.springframework.data.domain.Pageable pageable)
Page of entities matching the given Specification.spec - specpageable - pagejava.util.List<T> findAll(org.springframework.data.jpa.domain.Specification<T> spec, org.springframework.data.domain.Sort sort)
Specification and Sort.spec - specsort - sortlong count(org.springframework.data.jpa.domain.Specification<T> spec)
Specification will return.spec - the Specification to count instances fororg.springframework.data.domain.Page<T> findAll(T entity, org.springframework.data.domain.Pageable pageable)
org.springframework.data.domain.Page<T> findAll(T entity, org.springframework.data.domain.ExampleMatcher matcher, org.springframework.data.domain.Pageable pageable)
org.springframework.data.jpa.domain.Specification<T> handleQueryAnnotation(T entity)