E - Entity type.PK - Primary key type.public interface EntityRepository<E,PK extends Serializable> extends Deactivatable
| Modifier and Type | Method and Description |
|---|---|
void |
attachAndRemove(E entity)
Convenience access to
EntityManager.remove(Object)
with an detached entity. |
Long |
count()
Count all existing entities of entity class
<E>. |
Long |
count(E example,
javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
Count existing entities of entity class
<E>
with for a given object and a specific set of properties.. |
Long |
countLike(E example,
javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
Count existing entities of entity class using the like operator for String attributes
<E>
with for a given object and a specific set of properties.. |
List<E> |
findAll()
Lookup all existing entities of entity class
<E>. |
List<E> |
findAll(int start,
int max)
Lookup a range of existing entities of entity class
<E> with support for pagination. |
List<E> |
findBy(E example,
int start,
int max,
javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
Query by example - for a given object and a specific set of properties with support for pagination.
|
List<E> |
findBy(E example,
javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
Query by example - for a given object and a specific set of properties.
|
E |
findBy(PK primaryKey)
Entity lookup by primary key.
|
List<E> |
findByLike(E example,
int start,
int max,
javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
Query by example - for a given object and a specific set of properties
using a like operator for Strings with support for pagination.
|
List<E> |
findByLike(E example,
javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
Query by example - for a given object and a specific set of properties using a like operator for Strings.
|
void |
flush()
Convenience access to
EntityManager.flush(). |
void |
refresh(E entity)
Convenience access to
EntityManager.refresh(Object). |
void |
remove(E entity)
Convenience access to
EntityManager.remove(Object). |
void |
removeAndFlush(E entity)
Convenience access to
EntityManager.remove(Object)
with a following flush. |
E |
save(E entity)
Persist (new entity) or merge the given entity.
|
E |
saveAndFlush(E entity)
save(Object)s the given entity and flushes the persistence context afterwards. |
E |
saveAndFlushAndRefresh(E entity)
save(Object)s the given entity and flushes the persistence context afterwards,
followed by a refresh (e.g. |
E save(E entity)
EntityManagerDelegate which offers both
persist and merge.entity - Entity to save.E saveAndFlush(E entity)
save(Object)s the given entity and flushes the persistence context afterwards.entity - Entity to save.E saveAndFlushAndRefresh(E entity)
save(Object)s the given entity and flushes the persistence context afterwards,
followed by a refresh (e.g. to load DB trigger modifications).entity - Entity to save.void remove(E entity)
EntityManager.remove(Object).entity - Entity to remove.void removeAndFlush(E entity)
EntityManager.remove(Object)
with a following flush.entity - Entity to remove.void attachAndRemove(E entity)
EntityManager.remove(Object)
with an detached entity.entity - Entity to remove.void refresh(E entity)
EntityManager.refresh(Object).entity - Entity to refresh.void flush()
EntityManager.flush().E findBy(PK primaryKey)
EntityManager.find(Class, Object).primaryKey - DB primary key.List<E> findAll()
<E>.List<E> findAll(int start, int max)
<E> with support for pagination.start - The starting position.max - The maximum number of results to returnList<E> findBy(E example, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
example - Sample entity. Query all like.attributes - Which attributes to consider for the query.List<E> findBy(E example, int start, int max, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
example - Sample entity. Query all like.start - The starting position.max - The maximum number of results to returnattributes - Which attributes to consider for the query.List<E> findByLike(E example, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
example - Sample entity. Query all like.attributes - Which attributes to consider for the query.List<E> findByLike(E example, int start, int max, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
example - Sample entity. Query all like.start - The starting position.max - The maximum number of results to returnattributes - Which attributes to consider for the query.Long count()
<E>.Long count(E example, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
<E>
with for a given object and a specific set of properties..example - Sample entity. Query all like.attributes - Which attributes to consider for the query.Long countLike(E example, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
<E>
with for a given object and a specific set of properties..example - Sample entity. Query all like.attributes - Which attributes to consider for the query.Copyright © 2015 The Apache Software Foundation. All rights reserved.