JPA Propertyreferenceexception:no Property user found for user exception

Source: Internet
Author: User

Exception Details:

caused By:org.springframework.data.mapping.PropertyReferenceException:No property name found for type user!
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:213)
At Org.springframework.data.repository.query.parser.parttree$predicate.buildtree (PartTree.java:321)
At Org.springframework.data.repository.query.parser.parttree$predicate.<init> (PartTree.java:301)
At Org.springframework.data.repository.query.parser.parttree.<init> (parttree.java:85)
At Org.springframework.data.jpa.repository.query.parttreejpaquery.<init> (PartTreeJpaQuery.java:60)
At Org.springframework.data.jpa.repository.query.jpaquerylookupstrategy$createquerylookupstrategy.resolvequery ( jpaquerylookupstrategy.java:91)
At org.springframework.data.jpa.repository.query.jpaquerylookupstrategy$ Createifnotfoundquerylookupstrategy.resolvequery (jpaquerylookupstrategy.java:168)
At org.springframework.data.jpa.repository.query.jpaquerylookupstrategy$ Abstractquerylookupstrategy.resolvequery (jpaquerylookupstrategy.java:69)
At Org.springframework.data.repository.core.support.repositoryfactorysupport$queryexecutormethodinterceptor. <init> (repositoryfactorysupport.java:320)
At Org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository ( repositoryfactorysupport.java:169)
At Org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn ( repositoryfactorybeansupport.java:224)
At Org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet ( repositoryfactorybeansupport.java:210)
At Org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet ( jparepositoryfactorybean.java:92)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods ( abstractautowirecapablebeanfactory.java:1612)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1549)
... More

Workaround:

User findbyloginname (String loginName);
If you adopt the JPA default naming convention, you should write
User findbyloginname (String loginName); This will default to find the LoginName property
Otherwise findbyloginname This is the Login object's Name property, if you do not want to change the name of the best add @Query annotations to write clearly


JPA Propertyreferenceexception:no Property user found for user exception

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.