DATAJPA-1335 - Add missing @Override annotations.
Original pull request: #272.
This commit is contained in:
@@ -108,6 +108,7 @@ public class ThreeTenBackPortJpaConverters {
|
||||
@Converter(autoApply = true)
|
||||
public static class ZoneIdConverter implements AttributeConverter<ZoneId, String> {
|
||||
|
||||
@Override
|
||||
public String convertToDatabaseColumn(ZoneId zoneId) {
|
||||
return ZoneIdToStringConverter.INSTANCE.convert(zoneId);
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ public abstract class AbstractPersistable<PK extends Serializable> implements Pe
|
||||
* @see org.springframework.data.domain.Persistable#getId()
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public PK getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -66,6 +67,7 @@ public abstract class AbstractPersistable<PK extends Serializable> implements Pe
|
||||
* @see org.springframework.data.domain.Persistable#isNew()
|
||||
*/
|
||||
@Transient // DATAJPA-622
|
||||
@Override
|
||||
public boolean isNew() {
|
||||
return null == getId();
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ public enum PersistenceProvider implements QueryExtractor, ProxyIdAccessor {
|
||||
Collections.singletonList(HIBERNATE_ENTITY_MANAGER_INTERFACE), //
|
||||
Collections.singletonList(HIBERNATE_JPA_METAMODEL_TYPE)) {
|
||||
|
||||
@Override
|
||||
public String extractQueryString(Query query) {
|
||||
return HibernateUtils.getHibernateQuery(query);
|
||||
}
|
||||
@@ -119,6 +120,7 @@ public enum PersistenceProvider implements QueryExtractor, ProxyIdAccessor {
|
||||
ECLIPSELINK(Collections.singleton(ECLIPSELINK_ENTITY_MANAGER_INTERFACE),
|
||||
Collections.singleton(ECLIPSELINK_JPA_METAMODEL_TYPE)) {
|
||||
|
||||
@Override
|
||||
public String extractQueryString(Query query) {
|
||||
return ((JpaQuery<?>) query).getDatabaseQuery().getJPQLString();
|
||||
}
|
||||
@@ -307,6 +309,7 @@ public enum PersistenceProvider implements QueryExtractor, ProxyIdAccessor {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.query.QueryExtractor#canExtractQuery()
|
||||
*/
|
||||
@Override
|
||||
public boolean canExtractQuery() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,24 +39,28 @@ public interface JpaRepository<T, ID> extends PagingAndSortingRepository<T, ID>,
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#findAll()
|
||||
*/
|
||||
@Override
|
||||
List<T> findAll();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.PagingAndSortingRepository#findAll(org.springframework.data.domain.Sort)
|
||||
*/
|
||||
@Override
|
||||
List<T> findAll(Sort sort);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#findAll(java.lang.Iterable)
|
||||
*/
|
||||
@Override
|
||||
List<T> findAllById(Iterable<ID> ids);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#save(java.lang.Iterable)
|
||||
*/
|
||||
@Override
|
||||
<S extends T> List<S> saveAll(Iterable<S> entities);
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,6 +48,7 @@ public class AuditingBeanDefinitionParser implements BeanDefinitionParser {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.beans.factory.xml.BeanDefinitionParser#parse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)
|
||||
*/
|
||||
@Override
|
||||
public BeanDefinition parse(Element element, ParserContext parser) {
|
||||
|
||||
springConfiguredParser.parse(element, parser);
|
||||
@@ -92,6 +93,7 @@ public class AuditingBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
private static final String BEAN_CONFIGURER_ASPECT_CLASS_NAME = "org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect";
|
||||
|
||||
@Override
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
|
||||
if (!parserContext.getRegistry().containsBeanDefinition(BEAN_CONFIGURER_ASPECT_BEAN_NAME)) {
|
||||
|
||||
@@ -202,6 +202,7 @@ public class JpaRepositoryConfigExtension extends RepositoryConfigurationExtensi
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#getConfigurationInspectionClassLoader(org.springframework.core.io.ResourceLoader)
|
||||
*/
|
||||
@Override
|
||||
protected ClassLoader getConfigurationInspectionClassLoader(ResourceLoader loader) {
|
||||
|
||||
ClassLoader classLoader = loader.getClassLoader();
|
||||
|
||||
@@ -31,6 +31,7 @@ public class JpaRepositoryNameSpaceHandler extends NamespaceHandlerSupport {
|
||||
*
|
||||
* @see org.springframework.beans.factory.xml.NamespaceHandler#init()
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
RepositoryConfigurationExtension extension = new JpaRepositoryConfigExtension();
|
||||
|
||||
@@ -77,6 +77,7 @@ interface QueryParameterSetter {
|
||||
* @see org.springframework.data.jpa.repository.query.QueryParameterSetter#setParameter(javax.persistence.Query, java.lang.Object[])
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void setParameter(Query query, Object[] values, ErrorHandling errorHandling) {
|
||||
|
||||
Object value = valueExtractor.apply(values);
|
||||
|
||||
@@ -108,6 +108,7 @@ class CrudMethodMetadataPostProcessor implements RepositoryProxyPostProcessor, B
|
||||
* (non-Javadoc)
|
||||
* @see org.aopalliance.intercept.MethodInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
|
||||
*/
|
||||
@Override
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
|
||||
Method method = invocation.getMethod();
|
||||
|
||||
@@ -71,6 +71,7 @@ public abstract class JpaEntityInformationSupport<T, ID> extends AbstractEntityI
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.support.JpaEntityMetadata#getEntityName()
|
||||
*/
|
||||
@Override
|
||||
public String getEntityName() {
|
||||
return metadata.getEntityName();
|
||||
}
|
||||
|
||||
@@ -144,6 +144,7 @@ public class JpaMetamodelEntityInformation<T, ID> extends JpaEntityInformationSu
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.core.EntityInformation#getId(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
@SuppressWarnings("unchecked")
|
||||
public ID getId(T entity) {
|
||||
@@ -174,6 +175,7 @@ public class JpaMetamodelEntityInformation<T, ID> extends JpaEntityInformationSu
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.core.EntityInformation#getIdType()
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Class<ID> getIdType() {
|
||||
return (Class<ID>) idMetadata.getType();
|
||||
@@ -183,6 +185,7 @@ public class JpaMetamodelEntityInformation<T, ID> extends JpaEntityInformationSu
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.support.JpaEntityInformation#getIdAttribute()
|
||||
*/
|
||||
@Override
|
||||
public SingularAttribute<? super T, ?> getIdAttribute() {
|
||||
return idMetadata.getSimpleIdAttribute();
|
||||
}
|
||||
@@ -191,6 +194,7 @@ public class JpaMetamodelEntityInformation<T, ID> extends JpaEntityInformationSu
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.support.JpaEntityInformation#hasCompositeId()
|
||||
*/
|
||||
@Override
|
||||
public boolean hasCompositeId() {
|
||||
return !idMetadata.hasSimpleId();
|
||||
}
|
||||
@@ -199,6 +203,7 @@ public class JpaMetamodelEntityInformation<T, ID> extends JpaEntityInformationSu
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.support.JpaEntityInformation#getIdAttributeNames()
|
||||
*/
|
||||
@Override
|
||||
public Iterable<String> getIdAttributeNames() {
|
||||
|
||||
List<String> attributeNames = new ArrayList<String>(idMetadata.attributes.size());
|
||||
@@ -214,6 +219,7 @@ public class JpaMetamodelEntityInformation<T, ID> extends JpaEntityInformationSu
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.support.JpaEntityInformation#getCompositeIdAttributeValue(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Object getCompositeIdAttributeValue(Object id, String idAttribute) {
|
||||
|
||||
Assert.isTrue(hasCompositeId(), "Model must have a composite Id!");
|
||||
@@ -306,6 +312,7 @@ public class JpaMetamodelEntityInformation<T, ID> extends JpaEntityInformationSu
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Iterable#iterator()
|
||||
*/
|
||||
@Override
|
||||
public Iterator<SingularAttribute<? super T, ?>> iterator() {
|
||||
return attributes.iterator();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class JpaRepositoryFactoryBean<T extends Repository<S, ID>, S, ID>
|
||||
/**
|
||||
* Configures the {@link EntityPathResolver} to be used. Will expect a canonical bean to be present but fallback to
|
||||
* {@link SimpleEntityPathResolver#INSTANCE} in case none is available.
|
||||
*
|
||||
*
|
||||
* @param resolver must not be {@literal null}.
|
||||
*/
|
||||
@Autowired
|
||||
|
||||
@@ -114,6 +114,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
*
|
||||
* @param crudMethodMetadata
|
||||
*/
|
||||
@Override
|
||||
public void setRepositoryMethodMetadata(CrudMethodMetadata crudMethodMetadata) {
|
||||
this.metadata = crudMethodMetadata;
|
||||
}
|
||||
@@ -142,6 +143,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* @see org.springframework.data.repository.CrudRepository#delete(java.io.Serializable)
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void deleteById(ID id) {
|
||||
|
||||
Assert.notNull(id, ID_MUST_NOT_BE_NULL);
|
||||
@@ -155,6 +157,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* @see org.springframework.data.repository.CrudRepository#delete(java.lang.Object)
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void delete(T entity) {
|
||||
|
||||
Assert.notNull(entity, "The entity must not be null!");
|
||||
@@ -166,6 +169,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* @see org.springframework.data.repository.CrudRepository#delete(java.lang.Iterable)
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void deleteAll(Iterable<? extends T> entities) {
|
||||
|
||||
Assert.notNull(entities, "The given Iterable of entities not be null!");
|
||||
@@ -180,6 +184,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* @see org.springframework.data.jpa.repository.JpaRepository#deleteInBatch(java.lang.Iterable)
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void deleteInBatch(Iterable<T> entities) {
|
||||
|
||||
Assert.notNull(entities, "The given Iterable of entities not be null!");
|
||||
@@ -197,6 +202,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* @see org.springframework.data.repository.Repository#deleteAll()
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void deleteAll() {
|
||||
|
||||
for (T element : findAll()) {
|
||||
@@ -209,6 +215,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* @see org.springframework.data.jpa.repository.JpaRepository#deleteAllInBatch()
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void deleteAllInBatch() {
|
||||
em.createQuery(getDeleteAllQueryString()).executeUpdate();
|
||||
}
|
||||
@@ -217,6 +224,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#findById(java.io.Serializable)
|
||||
*/
|
||||
@Override
|
||||
public Optional<T> findById(ID id) {
|
||||
|
||||
Assert.notNull(id, ID_MUST_NOT_BE_NULL);
|
||||
@@ -259,6 +267,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#existsById(java.io.Serializable)
|
||||
*/
|
||||
@Override
|
||||
public boolean existsById(ID id) {
|
||||
|
||||
Assert.notNull(id, ID_MUST_NOT_BE_NULL);
|
||||
@@ -302,6 +311,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.JpaRepository#findAll()
|
||||
*/
|
||||
@Override
|
||||
public List<T> findAll() {
|
||||
return getQuery(null, Sort.unsorted()).getResultList();
|
||||
}
|
||||
@@ -310,6 +320,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#findAll(java.lang.Iterable)
|
||||
*/
|
||||
@Override
|
||||
public List<T> findAllById(Iterable<ID> ids) {
|
||||
|
||||
Assert.notNull(ids, "The given Iterable of Id's must not be null!");
|
||||
@@ -339,6 +350,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.JpaRepository#findAll(org.springframework.data.domain.Sort)
|
||||
*/
|
||||
@Override
|
||||
public List<T> findAll(Sort sort) {
|
||||
return getQuery(null, sort).getResultList();
|
||||
}
|
||||
@@ -347,6 +359,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.PagingAndSortingRepository#findAll(org.springframework.data.domain.Pageable)
|
||||
*/
|
||||
@Override
|
||||
public Page<T> findAll(Pageable pageable) {
|
||||
|
||||
if (isUnpaged(pageable)) {
|
||||
@@ -360,6 +373,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.JpaSpecificationExecutor#findOne(org.springframework.data.jpa.domain.Specification)
|
||||
*/
|
||||
@Override
|
||||
public Optional<T> findOne(@Nullable Specification<T> spec) {
|
||||
|
||||
try {
|
||||
@@ -373,6 +387,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.JpaSpecificationExecutor#findAll(org.springframework.data.jpa.domain.Specification)
|
||||
*/
|
||||
@Override
|
||||
public List<T> findAll(@Nullable Specification<T> spec) {
|
||||
return getQuery(spec, Sort.unsorted()).getResultList();
|
||||
}
|
||||
@@ -381,6 +396,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.JpaSpecificationExecutor#findAll(org.springframework.data.jpa.domain.Specification, org.springframework.data.domain.Pageable)
|
||||
*/
|
||||
@Override
|
||||
public Page<T> findAll(@Nullable Specification<T> spec, Pageable pageable) {
|
||||
|
||||
TypedQuery<T> query = getQuery(spec, pageable);
|
||||
@@ -392,6 +408,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.JpaSpecificationExecutor#findAll(org.springframework.data.jpa.domain.Specification, org.springframework.data.domain.Sort)
|
||||
*/
|
||||
@Override
|
||||
public List<T> findAll(@Nullable Specification<T> spec, Sort sort) {
|
||||
return getQuery(spec, sort).getResultList();
|
||||
}
|
||||
@@ -466,6 +483,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#count()
|
||||
*/
|
||||
@Override
|
||||
public long count() {
|
||||
return em.createQuery(getCountQueryString(), Long.class).getSingleResult();
|
||||
}
|
||||
@@ -474,6 +492,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.JpaSpecificationExecutor#count(org.springframework.data.jpa.domain.Specification)
|
||||
*/
|
||||
@Override
|
||||
public long count(@Nullable Specification<T> spec) {
|
||||
return executeCountQuery(getCountQuery(spec, getDomainClass()));
|
||||
}
|
||||
@@ -483,6 +502,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* @see org.springframework.data.repository.CrudRepository#save(java.lang.Object)
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public <S extends T> S save(S entity) {
|
||||
|
||||
if (entityInformation.isNew(entity)) {
|
||||
@@ -498,6 +518,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* @see org.springframework.data.jpa.repository.JpaRepository#saveAndFlush(java.lang.Object)
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public <S extends T> S saveAndFlush(S entity) {
|
||||
|
||||
S result = save(entity);
|
||||
@@ -511,6 +532,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* @see org.springframework.data.jpa.repository.JpaRepository#save(java.lang.Iterable)
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public <S extends T> List<S> saveAll(Iterable<S> entities) {
|
||||
|
||||
Assert.notNull(entities, "The given Iterable of entities not be null!");
|
||||
@@ -529,6 +551,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* @see org.springframework.data.jpa.repository.JpaRepository#flush()
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void flush() {
|
||||
em.flush();
|
||||
}
|
||||
@@ -770,6 +793,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.domain.Specification#toPredicate(javax.persistence.criteria.Root, javax.persistence.criteria.CriteriaQuery, javax.persistence.criteria.CriteriaBuilder)
|
||||
*/
|
||||
@Override
|
||||
public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
|
||||
|
||||
Path<?> path = root.get(entityInformation.getIdAttribute());
|
||||
|
||||
@@ -95,6 +95,7 @@ public class ClasspathScanningPersistenceUnitPostProcessor
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.context.ResourceLoaderAware#setResourceLoader(org.springframework.core.io.ResourceLoader)
|
||||
*/
|
||||
@Override
|
||||
public void setResourceLoader(ResourceLoader resourceLoader) {
|
||||
|
||||
Assert.notNull(resourceLoader, "ResourceLoader must not be null!");
|
||||
@@ -119,6 +120,7 @@ public class ClasspathScanningPersistenceUnitPostProcessor
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor#postProcessPersistenceUnitInfo(org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo)
|
||||
*/
|
||||
@Override
|
||||
public void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo pui) {
|
||||
|
||||
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
|
||||
|
||||
@@ -67,6 +67,7 @@ public class PersistableWithIdClass implements Persistable<PersistableWithIdClas
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Persistable#getId()
|
||||
*/
|
||||
@Override
|
||||
public PersistableWithIdClassPK getId() {
|
||||
return new PersistableWithIdClassPK(first, second);
|
||||
}
|
||||
@@ -74,6 +75,7 @@ public class PersistableWithIdClass implements Persistable<PersistableWithIdClas
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Persistable#isNew()
|
||||
*/
|
||||
@Override
|
||||
public boolean isNew() {
|
||||
return this.isNew;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ public class UserSpecifications {
|
||||
|
||||
return new Specification<User>() {
|
||||
|
||||
@Override
|
||||
public Predicate toPredicate(Root<User> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
|
||||
|
||||
return cb.like(root.get("firstname").as(String.class), String.format("%%%s%%", expression));
|
||||
@@ -79,6 +80,7 @@ public class UserSpecifications {
|
||||
|
||||
return new Specification<User>() {
|
||||
|
||||
@Override
|
||||
public Predicate toPredicate(Root<User> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
|
||||
|
||||
query.orderBy(cb.asc(root.get("firstname")));
|
||||
@@ -92,6 +94,7 @@ public class UserSpecifications {
|
||||
|
||||
return new Specification<T>() {
|
||||
|
||||
@Override
|
||||
public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
||||
|
||||
return builder.equal(root.get(property), value);
|
||||
|
||||
@@ -29,33 +29,41 @@ public class EclipseLinkEntityGraphRepositoryMethodsIntegrationTests
|
||||
|
||||
@Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627")
|
||||
@Test
|
||||
@Override
|
||||
public void shouldRespectNamedEntitySubGraph() {}
|
||||
|
||||
@Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627")
|
||||
@Test
|
||||
@Override
|
||||
public void shouldRespectMultipleSubGraphForSameAttributeWithDynamicFetchGraph() {}
|
||||
|
||||
@Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627")
|
||||
@Test
|
||||
@Override
|
||||
public void shouldRespectDynamicFetchGraphForGetOneWithAttributeNamesById() {}
|
||||
|
||||
@Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627")
|
||||
@Test
|
||||
@Override
|
||||
public void shouldRespectConfiguredJpaEntityGraphWithPaginationAndQueryDslPredicates() {}
|
||||
|
||||
@Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627")
|
||||
@Test
|
||||
@Override
|
||||
public void shouldRespectConfiguredJpaEntityGraphWithPaginationAndSpecification() {}
|
||||
|
||||
@Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627")
|
||||
@Test
|
||||
@Override
|
||||
public void shouldCreateDynamicGraphWithMultipleLevelsOfSubgraphs() {}
|
||||
|
||||
@Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627")
|
||||
@Test
|
||||
@Override
|
||||
public void shouldRespectConfiguredJpaEntityGraphInFindOne() {}
|
||||
|
||||
@Ignore("Bug 510627 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=510627")
|
||||
@Test
|
||||
@Override
|
||||
public void shouldRespectInferFetchGraphFromMethodName() {}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ public class ParentRepositoryIntegrationTests {
|
||||
public void testWithoutJoin() throws Exception {
|
||||
|
||||
Page<Parent> page = repository.findAll(new Specification<Parent>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<Parent> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
|
||||
Path<Set<Child>> childrenPath = root.get("children");
|
||||
query.distinct(true);
|
||||
@@ -82,6 +83,7 @@ public class ParentRepositoryIntegrationTests {
|
||||
@Test // DATAJPA-287
|
||||
public void testWithJoin() throws Exception {
|
||||
Page<Parent> page = repository.findAll(new Specification<Parent>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<Parent> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
|
||||
root.join("children");
|
||||
// we are interesting in distinct items, especially when join presents in query
|
||||
|
||||
@@ -46,6 +46,7 @@ public class CustomGenericJpaRepository<T, ID extends Serializable> extends Simp
|
||||
* org.springframework.data.jpa.repository.custom.CustomGenericRepository
|
||||
* #customMethod(java.io.Serializable)
|
||||
*/
|
||||
@Override
|
||||
public T customMethod(ID id) {
|
||||
|
||||
throw new UnsupportedOperationException("Forced exception for testing purposes.");
|
||||
|
||||
@@ -32,9 +32,11 @@ public interface UserCustomExtendedRepository extends CustomGenericRepository<Us
|
||||
/**
|
||||
* Sample method to test reconfiguring transactions on CRUD methods in combination with custom factory.
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = false, timeout = 10)
|
||||
List<User> findAll();
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = false, timeout = 10)
|
||||
Optional<User> findById(Integer id);
|
||||
}
|
||||
|
||||
@@ -234,6 +234,7 @@ public class JpaQueryExecutionUnitTests {
|
||||
doReturn(Optional.class).when(method).getReturnType();
|
||||
|
||||
StubQueryExecution execution = new StubQueryExecution() {
|
||||
@Override
|
||||
protected Object doExecute(AbstractJpaQuery query, Object[] values) {
|
||||
return "result";
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public interface EmployeeRepositoryWithEmbeddedId
|
||||
extends JpaRepository<EmbeddedIdExampleEmployee, EmbeddedIdExampleEmployeePK>,
|
||||
QuerydslPredicateExecutor<EmbeddedIdExampleEmployee> {
|
||||
|
||||
@Override
|
||||
List<EmbeddedIdExampleEmployee> findAll(Predicate predicate, OrderSpecifier<?>... orders);
|
||||
|
||||
// DATAJPA-920
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.querydsl.core.types.Predicate;
|
||||
public interface EmployeeRepositoryWithIdClass extends JpaRepository<IdClassExampleEmployee, IdClassExampleEmployeePK>,
|
||||
QuerydslPredicateExecutor<IdClassExampleEmployee> {
|
||||
|
||||
@Override
|
||||
List<IdClassExampleEmployee> findAll(Predicate predicate, OrderSpecifier<?>... orders);
|
||||
|
||||
// DATAJPA-920
|
||||
|
||||
@@ -30,5 +30,6 @@ import com.querydsl.core.types.Predicate;
|
||||
public interface MailMessageRepository
|
||||
extends JpaRepository<MailMessage, Long>, QuerydslPredicateExecutor<MailMessage> {
|
||||
|
||||
@Override
|
||||
List<MailMessage> findAll(Predicate predicate, OrderSpecifier<?>... orders);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public interface RedeclaringRepositoryMethodsRepository extends CrudRepository<U
|
||||
/**
|
||||
* Should not find any users at all.
|
||||
*/
|
||||
@Override
|
||||
@Query("SELECT u FROM User u where u.id = -1")
|
||||
List<User> findAll();
|
||||
|
||||
|
||||
@@ -46,12 +46,14 @@ public interface RepositoryMethodsWithEntityGraphConfigRepository
|
||||
/**
|
||||
* Should find all users.
|
||||
*/
|
||||
@Override
|
||||
@EntityGraph(type = EntityGraphType.LOAD, value = "User.overview")
|
||||
List<User> findAll();
|
||||
|
||||
/**
|
||||
* Should fetch all user details
|
||||
*/
|
||||
@Override
|
||||
@EntityGraph(type = EntityGraphType.FETCH, value = "User.detail")
|
||||
Optional<User> findById(Integer id);
|
||||
|
||||
@@ -64,6 +66,7 @@ public interface RepositoryMethodsWithEntityGraphConfigRepository
|
||||
User getOneWithAttributeNamesById(Integer id);
|
||||
|
||||
// DATAJPA-790
|
||||
@Override
|
||||
@EntityGraph("User.detail")
|
||||
Page<User> findAll(Predicate predicate, Pageable pageable);
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public interface RoleRepository extends CrudRepository<Role, Integer>, QuerydslP
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#findAll()
|
||||
*/
|
||||
@Override
|
||||
@Lock(LockModeType.READ)
|
||||
@QueryHints(@QueryHint(name = "foo", value = "bar"))
|
||||
Iterable<Role> findAll();
|
||||
@@ -48,6 +49,7 @@ public interface RoleRepository extends CrudRepository<Role, Integer>, QuerydslP
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.CrudRepository#findOne(java.io.Serializable)
|
||||
*/
|
||||
@Override
|
||||
@Lock(LockModeType.READ)
|
||||
@QueryHints(@QueryHint(name = "foo", value = "bar"))
|
||||
Optional<Role> findById(Integer id);
|
||||
|
||||
@@ -44,6 +44,7 @@ public class SampleEvaluationContextExtension implements EvaluationContextExtens
|
||||
|
||||
private static ThreadLocal<SampleAuthentication> auth = new ThreadLocal<SampleAuthentication>() {
|
||||
|
||||
@Override
|
||||
protected SampleAuthentication initialValue() {
|
||||
return new SampleAuthentication(new SampleUser(-1, "anonymous"));
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ public interface UserRepository
|
||||
* Redeclaration of {@link CrudRepository#findById(java.io.Serializable)} to change transaction configuration.
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
java.util.Optional<User> findById(Integer primaryKey);
|
||||
|
||||
/**
|
||||
@@ -75,6 +76,7 @@ public interface UserRepository
|
||||
* configuration of the original method is considered if the redeclaration does not carry a {@link Transactional}
|
||||
* annotation.
|
||||
*/
|
||||
@Override
|
||||
void deleteById(Integer id); // DATACMNS-649
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,6 +40,7 @@ public class UserRepositoryImpl implements UserRepositoryCustom {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.sample.UserRepositoryCustom#someCustomMethod(org.springframework.data.jpa.domain.sample.User)
|
||||
*/
|
||||
@Override
|
||||
public void someCustomMethod(User u) {
|
||||
LOG.debug("Some custom method was invoked!");
|
||||
}
|
||||
@@ -48,6 +49,7 @@ public class UserRepositoryImpl implements UserRepositoryCustom {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.jpa.repository.sample.UserRepositoryCustom#findByOverrridingMethod()
|
||||
*/
|
||||
@Override
|
||||
public void findByOverrridingMethod() {
|
||||
LOG.debug("A method overriding a finder was invoked!");
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ public class EclipseLinkJpaMetamodelEntityInformationIntegrationTests
|
||||
* Re-activate test for DATAJPA-820.
|
||||
*/
|
||||
@Test
|
||||
@Override
|
||||
public void detectsVersionPropertyOnMappedSuperClass() {
|
||||
super.detectsVersionPropertyOnMappedSuperClass();
|
||||
}
|
||||
|
||||
@@ -74,26 +74,32 @@ public class JpaEntityInformationSupportUnitTests {
|
||||
super(domainClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingularAttribute<? super T, ?> getIdAttribute() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ID getId(T entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ID> getIdType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getIdAttributeNames() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCompositeId() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCompositeIdAttributeValue(Object id, String idAttribute) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -74,11 +74,13 @@ public class JpaPersistableEntityInformationUnitTests {
|
||||
|
||||
Long id;
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNew() {
|
||||
|
||||
return id != null;
|
||||
|
||||
@@ -167,6 +167,7 @@ public class JpaRepositoryFactoryUnitTests {
|
||||
private interface SimpleSampleRepository extends JpaRepository<User, Integer> {
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
Optional<User> findById(Integer id);
|
||||
}
|
||||
|
||||
@@ -189,11 +190,13 @@ public class JpaRepositoryFactoryUnitTests {
|
||||
*/
|
||||
private class SampleCustomRepositoryImpl implements SampleCustomRepository {
|
||||
|
||||
@Override
|
||||
public void throwingRuntimeException() {
|
||||
|
||||
throw new IllegalArgumentException("You lose!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void throwingCheckedException() throws IOException {
|
||||
|
||||
throw new IOException("You lose!");
|
||||
|
||||
@@ -46,6 +46,7 @@ public class OpenJpaMetamodelEntityInformationIntegrationTests extends JpaMetamo
|
||||
* Re-activate test for DATAJPA-820.
|
||||
*/
|
||||
@Test
|
||||
@Override
|
||||
public void detectsVersionPropertyOnMappedSuperClass() {
|
||||
super.detectsVersionPropertyOnMappedSuperClass();
|
||||
}
|
||||
|
||||
@@ -137,14 +137,17 @@ public class QuerydslRepositorySupportTests {
|
||||
super.setEntityManager(entityManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> findUsersByLastname(String lastname) {
|
||||
return from(user).where(user.lastname.eq(lastname)).fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long updateLastnamesTo(String lastname) {
|
||||
return update(user).set(user.lastname, lastname).execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long deleteAllWithLastname(String lastname) {
|
||||
return delete(user).where(user.lastname.eq(lastname)).execute();
|
||||
}
|
||||
|
||||
@@ -102,11 +102,13 @@ public class TransactionalRepositoryTests extends AbstractJUnit4SpringContextTes
|
||||
this.txManager = txManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commit(TransactionStatus status) throws TransactionException {
|
||||
|
||||
txManager.commit(status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException {
|
||||
|
||||
this.transactionRequests++;
|
||||
@@ -131,6 +133,7 @@ public class TransactionalRepositoryTests extends AbstractJUnit4SpringContextTes
|
||||
this.definition = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollback(TransactionStatus status) throws TransactionException {
|
||||
|
||||
txManager.rollback(status);
|
||||
|
||||
@@ -120,6 +120,7 @@ public class ClasspathScanningPersistenceUnitPostProcessorUnitTests {
|
||||
|
||||
ResourceLoader resolver = new PathMatchingResourcePatternResolver(new DefaultResourceLoader()) {
|
||||
|
||||
@Override
|
||||
public Resource[] getResources(String locationPattern) throws IOException {
|
||||
|
||||
Resource[] resources = super.getResources(locationPattern);
|
||||
|
||||
Reference in New Issue
Block a user