T - the domain classID - the type of the Id of the domain classpublic class SearchRepositoryImpl<T,ID extends Serializable> extends org.springframework.data.jpa.repository.support.SimpleJpaRepository<T,ID> implements SearchRepository<T,ID>
SearchRepository implementation.SearchRepository implementations:
<repositories base-class="org.appng.persistence.repository.SearchRepositoryImpl">See 4.6.2. Adding custom behavior to all repositories from the reference Documentation for further details.
| Modifier and Type | Field and Description |
|---|---|
protected Class<T> |
domainClass |
protected javax.persistence.EntityManager |
entityManager |
| Constructor and Description |
|---|
SearchRepositoryImpl(Class<T> domainType,
javax.persistence.EntityManager entityManager) |
SearchRepositoryImpl(org.springframework.data.jpa.repository.support.JpaEntityInformation<T,?> entityInformation,
javax.persistence.EntityManager entityManager) |
| Modifier and Type | Method and Description |
|---|---|
SearchQuery<T> |
createSearchQuery()
Creates and returns a new
SearchQuery. |
void |
detach(T entity)
Detaches the entity from the underlying
EntityManager. |
org.springframework.data.domain.Page<T> |
findAll(org.springframework.data.domain.Pageable pageable) |
Collection<T> |
getHistory(ID id)
Returns all previous revisions (starting with the newest) for the entity with the given ID (if the domain-class
is audited).
|
T |
getRevision(ID id,
Number revision)
Returns the requested revision of the entity with the requested ID (if the domain-class is audited);
|
Number |
getRevisionNumber(ID id)
If the domain-class is audited, the latest revision number of the entity is returned.
|
boolean |
isUnique(ID id,
String[] properties,
Object[] values)
Checks whether the given properties are unique for this domain type.
|
boolean |
isUnique(ID id,
String property,
Object value)
Checks whether the given property is unique for this domain type.
|
org.springframework.data.domain.Page<T> |
search(org.springframework.data.domain.Pageable pageable)
Performs a paginated search.
In contrast to PagingAndSortingRepository.findAll(Pageable), this method is able to re-calculate the
pagination. |
org.springframework.data.domain.Page<T> |
search(SearchQuery<T> searchQuery,
org.springframework.data.domain.Pageable pageable)
Performs a paginated search with the given
SearchQuery. |
List<T> |
search(String queryString,
Object... args)
Performs a search with the given query-String.
|
org.springframework.data.domain.Page<T> |
search(String queryString,
String entityName,
org.springframework.data.domain.Pageable pageable,
Object... args)
Performs a paginated search based upon the given query-String.Note that the query string must start with "from
<Entity> <entityName>"!
|
count, count, count, delete, delete, delete, deleteAll, deleteAllInBatch, deleteInBatch, exists, exists, findAll, findAll, findAll, findAll, findAll, findAll, findAll, findAll, findAll, findOne, findOne, findOne, flush, getCountQuery, getCountQuery, getDomainClass, getOne, getQuery, getQuery, getQuery, getQuery, getQueryHints, getRepositoryMethodMetadata, readPage, readPage, save, save, saveAndFlush, setEscapeCharacter, setRepositoryMethodMetadataclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAll, flush, getOne, save, saveAndFlushcount, delete, delete, delete, deleteAll, exists, findOne, savepublic SearchRepositoryImpl(org.springframework.data.jpa.repository.support.JpaEntityInformation<T,?> entityInformation, javax.persistence.EntityManager entityManager)
public org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable)
findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T,ID extends Serializable>findAll in class org.springframework.data.jpa.repository.support.SimpleJpaRepository<T,ID extends Serializable>public org.springframework.data.domain.Page<T> search(org.springframework.data.domain.Pageable pageable)
SearchRepositoryPagingAndSortingRepository.findAll(Pageable), this method is able to re-calculate the
pagination. This means, if Pageable.getOffset() returns a higher number than
Page.getTotalElements(), a new Pageable is created, starting with page 0.search in interface SearchRepository<T,ID extends Serializable>pageable - a PageablePage containing the resultpublic org.springframework.data.domain.Page<T> search(String queryString, String entityName, org.springframework.data.domain.Pageable pageable, Object... args)
SearchRepositorysearch in interface SearchRepository<T,ID extends Serializable>queryString - the JPQL-query, starting with "from <Entity> <entityName>"entityName - the alias used for the entity within the query.from Foo f, then the entityName needs to be f.pageable - a Pageableargs - the parameters to be applied to the Query, using
Query.setParameter(int, Object).Page containing the resultpublic List<T> search(String queryString, Object... args)
SearchRepositorysearch in interface SearchRepository<T,ID extends Serializable>queryString - the JPQL-queryargs - the parameters to be applied to the Query, using
Query.setParameter(int, Object).Page containing the resultpublic org.springframework.data.domain.Page<T> search(SearchQuery<T> searchQuery, org.springframework.data.domain.Pageable pageable)
SearchRepositorySearchQuery.search in interface SearchRepository<T,ID extends Serializable>searchQuery - the SearchQuerypageable - a Pageable (optional)Page containing the result. When pageable is null, a single page containing all results
will be returnedpublic Collection<T> getHistory(ID id)
SearchRepositorygetHistory in interface SearchRepository<T,ID extends Serializable>id - the ID of the entitypublic T getRevision(ID id, Number revision)
SearchRepositorygetRevision in interface SearchRepository<T,ID extends Serializable>id - the ID of the entityrevision - the revision of the entitynull is returned.public Number getRevisionNumber(ID id)
SearchRepositorygetRevisionNumber in interface SearchRepository<T,ID extends Serializable>id - the ID of the entity to get the revision for.null if the domain-class is not audited or an entity with this ID
does not existpublic boolean isUnique(ID id, String property, Object value)
SearchRepositoryisUnique in interface SearchRepository<T,ID extends Serializable>id - the ID of the entity to check, may be null if it's a new entityproperty - the name of the property to check uniqueness for, must not be nullvalue - the value of the property to check uniqueness for, must not be nulltrue, if there is no other entity where the given property has the given value, false
otherwisepublic boolean isUnique(ID id, String[] properties, Object[] values)
SearchRepositoryisUnique in interface SearchRepository<T,ID extends Serializable>id - the ID of the entity to check, may be null if it's a new entityproperties - the names of the properties to check uniqueness for, must not be nullvalues - the values of the properties to check uniqueness for, must not be nulltrue, if there is no other entity where the given properties have the given values, false
otherwisepublic void detach(T entity)
SearchRepositoryEntityManager.detach in interface SearchRepository<T,ID extends Serializable>entity - the entity to detachpublic SearchQuery<T> createSearchQuery()
SearchRepositorySearchQuery.createSearchQuery in interface SearchRepository<T,ID extends Serializable>SearchQueryCopyright © 2011–2023 aiticon GmbH. All rights reserved.