org.springframework.data.mapping.PropertyReferenceException: No property findAllAdults found for type MyEntity!

Spring JIRA | member sound | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I'm trying to use custom {{@NamedQuery}} for a {{JpaRepository}}. In general it works, but as soon as I overload a method with the Sort parameter, I'm getting a {{PropertyReferenceException}}. {code:java} public interface MyEntityRepository extends JpaRepository<MyEntity, Long> { List<MyEntity> findAllAdults(Pageable pageable); List<MyEntity> findAllAdults(); //List<MyEntity> findAllAdults(Sort sort); uncomment to get the PropertyReferenceException } @Entity @NamedQuery( name = MyEntity.FIND_ALL_ADULTS, query = "select t from MyEntity t where t.age >= 18" ) public class MyEntity { public static final String FIND_ALL_ADULTS = "MyEntity.findAllAdults"; private Long id; private int age; } {code} Result: {code:java} org.springframework.data.mapping.PropertyReferenceException: No property findAllAdults found for type MyEntity! 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) at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:235) at org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:373) at org.springframework.data.repository.query.parser.PartTree$Predicate.<init>(PartTree.java:353) at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:84) at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:61) at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:94) at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:205) at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:72) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:369) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:192) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:239) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:225) at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) ... 28 more {code}

    Spring JIRA | 2 years ago | member sound
    org.springframework.data.mapping.PropertyReferenceException: No property findAllAdults found for type MyEntity!
  2. 0

    I'm trying to use custom {{@NamedQuery}} for a {{JpaRepository}}. In general it works, but as soon as I overload a method with the Sort parameter, I'm getting a {{PropertyReferenceException}}. {code:java} public interface MyEntityRepository extends JpaRepository<MyEntity, Long> { List<MyEntity> findAllAdults(Pageable pageable); List<MyEntity> findAllAdults(); //List<MyEntity> findAllAdults(Sort sort); uncomment to get the PropertyReferenceException } @Entity @NamedQuery( name = MyEntity.FIND_ALL_ADULTS, query = "select t from MyEntity t where t.age >= 18" ) public class MyEntity { public static final String FIND_ALL_ADULTS = "MyEntity.findAllAdults"; private Long id; private int age; } {code} Result: {code:java} org.springframework.data.mapping.PropertyReferenceException: No property findAllAdults found for type MyEntity! 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) at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:235) at org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:373) at org.springframework.data.repository.query.parser.PartTree$Predicate.<init>(PartTree.java:353) at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:84) at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:61) at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:94) at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:205) at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:72) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:369) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:192) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:239) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:225) at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) ... 28 more {code}

    Spring JIRA | 2 years ago | member sound
    org.springframework.data.mapping.PropertyReferenceException: No property findAllAdults found for type MyEntity!
  3. 0

    How to use @NamedQuery in spring a CrudRepository @Query?

    Stack Overflow | 2 years ago | membersound
    org.springframework.data.mapping.PropertyReferenceException: No property findAllCustom found for type MyEntity!
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Error in query in Jpa with SpringBoot

    Stack Overflow | 2 years ago | Soham
    org.springframework.data.mapping.PropertyReferenceException: No property UserId found for type User!
  6. 0

    Spring-JPA repository custom behaviour

    Stack Overflow | 1 year ago | H.Sheng
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobStatusRespository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property retrieveJobStatus found for type JobStatusEntity!
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.springframework.data.mapping.PropertyReferenceException

    No property findAllAdults found for type MyEntity!

    at org.springframework.data.mapping.PropertyPath.<init>()
  2. Spring Data Core
    PartTree.<init>
    1. org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:75)
    2. org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327)
    3. org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307)
    4. org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270)
    5. org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:241)
    6. org.springframework.data.repository.query.parser.Part.<init>(Part.java:76)
    7. org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:235)
    8. org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:373)
    9. org.springframework.data.repository.query.parser.PartTree$Predicate.<init>(PartTree.java:353)
    10. org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:84)
    10 frames
  3. Spring Data JPA
    JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery
    1. org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:61)
    2. org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:94)
    3. org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:205)
    4. org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:72)
    4 frames
  4. Spring Data Core
    RepositoryFactoryBeanSupport.afterPropertiesSet
    1. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:369)
    2. org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:192)
    3. org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:239)
    4. org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:225)
    4 frames
  5. Spring Data JPA
    JpaRepositoryFactoryBean.afterPropertiesSet
    1. org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92)
    1 frame
  6. Spring Beans
    AbstractAutowireCapableBeanFactory.initializeBean
    1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633)
    2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
    2 frames