接口 CrudService<T,ID extends java.io.Serializable>
-
- 所有已知实现类:
BaseService
public interface CrudService<T,ID extends java.io.Serializable>
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 longcount()Returns the number of entities available.longcount(org.springframework.data.jpa.domain.Specification<T> spec)Returns the number of instances that the givenSpecificationwill return.voiddelete(ID id)Deletes the entity with the given id.voiddelete(ID[] ids)voiddelete(ID[] ids, boolean isPhysical)voiddelete(ID id, boolean isPhysical)Deletes the entity with the given id.voiddelete(java.lang.Iterable<? extends T> entities)Deletes the given entities.voiddelete(java.lang.Iterable<? extends T> entities, boolean isPhysical)Deletes the given entities.voiddelete(java.util.List<ID> ids)voiddelete(java.util.List<ID> ids, boolean isPhysical)voiddelete(T entity)Deletes a given entity.voiddelete(T entity, boolean isPhysical)Deletes a given entity.voiddeleteAll()Deletes all entities managed by the repository.voiddeleteAll(boolean isPhysical)Deletes all entities managed by the repository.booleanexists(ID id)Returns whether an entity with the given id exists.java.lang.Iterable<T>findAll()Returns all instances of the type.java.lang.Iterable<T>findAll(java.lang.Iterable<ID> ids)Returns all instances of the type with the given IDs.<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)java.util.List<T>findAll(org.springframework.data.jpa.domain.Specification<T> spec)Returns all entities matching the givenSpecification.org.springframework.data.domain.Page<T>findAll(org.springframework.data.jpa.domain.Specification<T> spec, org.springframework.data.domain.Pageable pageable)Returns aPageof entities matching the givenSpecification.java.util.List<T>findAll(org.springframework.data.jpa.domain.Specification<T> spec, org.springframework.data.domain.Sort sort)Returns all entities matching the givenSpecificationandSort.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)TfindOne(ID id)Retrieves an entity by its id.TfindOne(org.springframework.data.jpa.domain.Specification<T> spec)Returns a single entity matching the givenSpecification.TgetOne(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>
java.lang.Iterable<S>save(java.lang.Iterable<S> entities)Saves all given entities.<S extends T>
Ssave(S entity)Saves a given entity.Tupdate(ID id, T entity)fetch an entity
-
-
-
方法详细资料
-
save
<S extends T> S save(S entity)
Saves a given entity. Use the returned instance for further operations as the save operation might have changed the entity instance completely.- 类型参数:
S- S- 参数:
entity- Jpa Entity- 返回:
- the saved entity
-
save
<S extends T> java.lang.Iterable<S> save(java.lang.Iterable<S> entities)
Saves all given entities.- 类型参数:
S- S- 参数:
entities- The entities- 返回:
- the saved entities
- 抛出:
java.lang.IllegalArgumentException- in case the given entity is null.
-
findOne
T findOne(ID id)
Retrieves an entity by its id.- 参数:
id- must not be null.- 返回:
- the entity with the given id or null if none found
- 抛出:
java.lang.IllegalArgumentException- ifidis null
-
getOne
T getOne(ID id)
Returns a reference to the entity with the given identifier.- 参数:
id- must not be null.- 返回:
- a reference to the entity with the given identifier.
- 另请参阅:
EntityManager.getReference(Class, Object)
-
exists
boolean exists(ID id)
Returns whether an entity with the given id exists.- 参数:
id- must not be null.- 返回:
- true if an entity with the given id exists, false otherwise
- 抛出:
java.lang.IllegalArgumentException- ifidis null
-
findAll
java.lang.Iterable<T> findAll()
Returns all instances of the type.- 返回:
- all entities
-
findAll
java.lang.Iterable<T> findAll(java.lang.Iterable<ID> ids)
Returns all instances of the type with the given IDs.- 参数:
ids- ids- 返回:
- I
-
count
long count()
Returns the number of entities available.- 返回:
- the number of entities
-
delete
void delete(ID id)
Deletes the entity with the given id.- 参数:
id- must not be null.- 抛出:
java.lang.IllegalArgumentException- in case the givenidis null
-
delete
void delete(java.util.List<ID> ids)
-
delete
void delete(ID[] ids)
-
delete
void delete(T entity)
Deletes a given entity.- 参数:
entity- The entity- 抛出:
java.lang.IllegalArgumentException- in case the given entity is null.
-
delete
void delete(java.lang.Iterable<? extends T> entities)
Deletes the given entities.- 参数:
entities- The entities- 抛出:
java.lang.IllegalArgumentException- in case the givenIterableis null.
-
deleteAll
void deleteAll()
Deletes all entities managed by the repository.
-
findAll
<S extends T> java.lang.Iterable<S> findAll(org.springframework.data.domain.Example<S> example)
-
findAll
<S extends T> org.springframework.data.domain.Page<S> findAll(org.springframework.data.domain.Example<S> example, org.springframework.data.domain.Pageable pageable)
-
delete
void delete(ID id, boolean isPhysical)
Deletes the entity with the given id.- 参数:
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 givenidis null
-
delete
void delete(java.util.List<ID> ids, boolean isPhysical)
-
delete
void delete(ID[] ids, boolean isPhysical)
-
delete
void delete(T entity, boolean isPhysical)
Deletes a given entity.- 参数:
entity- entityisPhysical- py- 抛出:
java.lang.IllegalArgumentException- in case the given entity is null.
-
delete
void delete(java.lang.Iterable<? extends T> entities, boolean isPhysical)
Deletes the given entities.- 参数:
entities- entitiesisPhysical- py- 抛出:
java.lang.IllegalArgumentException- in case the givenIterableis null.
-
deleteAll
void deleteAll(boolean isPhysical)
Deletes all entities managed by the repository.- 参数:
isPhysical- py
-
findOne
T findOne(org.springframework.data.jpa.domain.Specification<T> spec)
Returns a single entity matching the givenSpecification.- 参数:
spec- spec- 返回:
- T
-
findAll
java.util.List<T> findAll(org.springframework.data.jpa.domain.Specification<T> spec)
Returns all entities matching the givenSpecification.- 参数:
spec- spec- 返回:
- List T
-
findAll
org.springframework.data.domain.Page<T> findAll(org.springframework.data.jpa.domain.Specification<T> spec, org.springframework.data.domain.Pageable pageable)
Returns aPageof entities matching the givenSpecification.- 参数:
spec- specpageable- page- 返回:
- Page T
-
findAll
java.util.List<T> findAll(org.springframework.data.jpa.domain.Specification<T> spec, org.springframework.data.domain.Sort sort)
Returns all entities matching the givenSpecificationandSort.- 参数:
spec- specsort- sort- 返回:
- List T
-
count
long count(org.springframework.data.jpa.domain.Specification<T> spec)
Returns the number of instances that the givenSpecificationwill return.- 参数:
spec- theSpecificationto count instances for- 返回:
- the number of instances
-
findAll
org.springframework.data.domain.Page<T> findAll(T entity, org.springframework.data.domain.Pageable pageable)
-
findAll
java.util.List<T> findAll(T entity, org.springframework.data.domain.ExampleMatcher matcher)
-
findAll
org.springframework.data.domain.Page<T> findAll(T entity, org.springframework.data.domain.ExampleMatcher matcher, org.springframework.data.domain.Pageable pageable)
-
handleQueryAnnotation
org.springframework.data.jpa.domain.Specification<T> handleQueryAnnotation(T entity)
-
-