I have added a custom interface with a single custom method onto a Spring Data JpaRespository, as detailed in the answer to this question;
How to add custom method to Spring Data JPA
However now I get the following error;
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property customMethod found for type Account!
at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:75)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:241)
at org.springframework.data.repository.query.parser.Part.<init>(Part.java:76)
This appears to be because Spring Data is trying to generate a query for "customMethod" thinking its a property of "Account".
How I can stop automatic query generation for a given method?!
UPDATE My code specifically is as follows;
public interface CacheInvalidatingRepo<T> {
public void invalidateCache(T obj);
}
@Component
public class CacheInvalidatingRepoImpl<T> implements CacheInvalidatingRepo<T> {
@Override
public void invalidateCache(T obj) {
// kill the entity manager cache
}
}
public interface VerificationRepo extends JpaRepository<Verification, BigInteger>, JpaSpecificationExecutor<Verification>, CacheInvalidatingRepo<Verification> {
}
Results in the following;
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property invalidateCachefound for type Verification!
at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:75)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:241)
at org.springframework.data.repository.query.parser.Part.<init>(Part.java:76)