org.hibernate.QueryException: could not resolve property: class of: hibernatetypeissue.Leaf [select l from hibernatetypeissue.Leaf l where TYPE(l.tree) = PineTree]

Hibernate JIRA | Bob | 2 years ago
  1. 0

    When using the JPA 2.1 TYPE expression with a path expression such as "leaf.tree" an exception [1] occurs when executing the query. It should be valid according to the jpa 2.1 spec. If the path expression is used as a join and the joined variable is used as the argument to the type expression the query works as expected. An example is (the example can also be found in the attached test case): select l from Leaf l where TYPE(l.tree) = PineTree gives the exception [1] the following does work howerver select l from Leaf l join l.tree t where TYPE(t) = PineTree [1]: 2015-05-22 11:50:20,756 ERROR SessionFactoryImpl - HHH000177: Error in named query: type-fails org.hibernate.QueryException: could not resolve property: class of: hibernatetypeissue.Leaf [select l from hibernatetypeissue.Leaf l where TYPE(l.tree) = PineTree] at org.hibernate.QueryException.generateQueryException(QueryException.java:137) at org.hibernate.QueryException.wrapWithQueryString(QueryException.java:120) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:234) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167) at org.hibernate.internal.NamedQueryRepository.checkNamedQueries(NamedQueryRepository.java:161) at org.hibernate.internal.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:1090) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:536) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849) at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)

    Hibernate JIRA | 2 years ago | Bob
    org.hibernate.QueryException: could not resolve property: class of: hibernatetypeissue.Leaf [select l from hibernatetypeissue.Leaf l where TYPE(l.tree) = PineTree]
  2. 0

    When using the JPA 2.1 TYPE expression with a path expression such as "leaf.tree" an exception [1] occurs when executing the query. It should be valid according to the jpa 2.1 spec. If the path expression is used as a join and the joined variable is used as the argument to the type expression the query works as expected. An example is (the example can also be found in the attached test case): select l from Leaf l where TYPE(l.tree) = PineTree gives the exception [1] the following does work howerver select l from Leaf l join l.tree t where TYPE(t) = PineTree [1]: 2015-05-22 11:50:20,756 ERROR SessionFactoryImpl - HHH000177: Error in named query: type-fails org.hibernate.QueryException: could not resolve property: class of: hibernatetypeissue.Leaf [select l from hibernatetypeissue.Leaf l where TYPE(l.tree) = PineTree] at org.hibernate.QueryException.generateQueryException(QueryException.java:137) at org.hibernate.QueryException.wrapWithQueryString(QueryException.java:120) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:234) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167) at org.hibernate.internal.NamedQueryRepository.checkNamedQueries(NamedQueryRepository.java:161) at org.hibernate.internal.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:1090) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:536) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849) at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)

    Hibernate JIRA | 2 years ago | Bob
    org.hibernate.QueryException: could not resolve property: class of: hibernatetypeissue.Leaf [select l from hibernatetypeissue.Leaf l where TYPE(l.tree) = PineTree]
  3. 0

    Error in Insert into select from table in hibernate

    Stack Overflow | 1 year ago | Nidhi
    org.hibernate.QueryException: could not resolve property: of: com.csc.pt.svc.data.to.Basoseext2TO [ insert into Basoseext2TO(id.location,id.masterco,id.symbol,id.policyno,id.module,id.filename,id.thedata) select substring(id.thedata, 1, 2), substring(id.thedata, 3, 2), substring(id.thedata, 5, 3), substring(id.thedata, 8, 7), substring(id.thedata, 15, 2), substring(id.thedata, 17, 10), substring(id.thedata, 27, 3976) from com.csc.pt.svc.data.to.ExtrfileTO ExtrfileTO ]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    RROR [org.hibernate.internal.SessionFactoryImpl] - HHH000177: Error in named query: User.get org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=T_SEC_Role,tableAlias=role2_,origin=T_SEC_User_Party_Role userpartyr1_,columns={userpartyr1_.roleId ,className=com.gixon.apps.security.domain.model.Role}}] [SELECT u FROM com.gixon.apps.security.domain.model.User u left join fetch u.userAccount left join fetch u.userPartyRoles pr left join fetch pr.role WHERE u.id = :id and u.lifecycleStages!='DISABLE'] at org.hibernate.hql.internal.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:204) at org.hibernate.hql.internal.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:859) at org.hibernate.hql.internal.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:649) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:663) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:299) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:247) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:248) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168) at org.hibernate.internal.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:1069) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:517) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1750) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:286) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:285) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:873) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:815) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:730) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1120) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:106) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:57) at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:100) at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:248) at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124) at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:103) at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:73) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:313) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:284) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) at org.junit.runners.ParentRunner.run(ParentRunner.java:292) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

    Hibernate JIRA | 3 years ago | binchen
    org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=T_SEC_Role,tableAlias=role2_,origin=T_SEC_User_Party_Role userpartyr1_,columns={userpartyr1_.roleId ,className=com.gixon.apps.security.domain.model.Role}}] [SELECT u FROM com.gixon.apps.security.domain.model.User u left join fetch u.userAccount left join fetch u.userPartyRoles pr left join fetch pr.role WHERE u.id = :id and u.lifecycleStages!='DISABLE']
  6. 0

    [HHH-9256] Receiving "Error in named query: org.hibernate.QueryException: could not resolve property xxx" if annotating on property not on field

    https://bugzilla.redhat.com/bugzilla/ | 2 years ago | Gary Hu
    org.hibernate.QueryException: could not resolve property: xxx of: xxxx [from EntityA a where a.entityB.someId = :someId ]

    1 unregistered visitors
    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.hibernate.QueryException

      could not resolve property: class of: hibernatetypeissue.Leaf [select l from hibernatetypeissue.Leaf l where TYPE(l.tree) = PineTree]

      at org.hibernate.QueryException.generateQueryException()
    2. Hibernate
      Configuration.buildSessionFactory
      1. org.hibernate.QueryException.generateQueryException(QueryException.java:137)
      2. org.hibernate.QueryException.wrapWithQueryString(QueryException.java:120)
      3. org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:234)
      4. org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
      5. org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131)
      6. org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93)
      7. org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167)
      8. org.hibernate.internal.NamedQueryRepository.checkNamedQueries(NamedQueryRepository.java:161)
      9. org.hibernate.internal.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:1090)
      10. org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:536)
      11. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859)
      11 frames
    3. org.hibernate.jpa
      EntityManagerFactoryBuilderImpl$4.perform
      1. org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)
      2. org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
      2 frames
    4. org.hibernate.boot
      ClassLoaderServiceImpl.withTccl
      1. org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)
      1 frame
    5. org.hibernate.jpa
      HibernatePersistenceProvider.createEntityManagerFactory
      1. org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
      2. org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75)
      2 frames
    6. Hibernate EJB
      HibernatePersistence.createEntityManagerFactory
      1. org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54)
      1 frame
    7. JavaEE 7
      Persistence.createEntityManagerFactory
      1. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
      2. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
      2 frames