org.hibernate.MappingException: unknown property: city

Hibernate JIRA | Andrey Panasyuk | 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

    final Query jpqlQuery = em.createQuery("from UserProfile p where p.address.city = :city"); jpqlQuery.setParameter("city", "test"); Please find attached project to reproduce the issue. Neo4JTest can be used as an entry point Exception: org.hibernate.MappingException: unknown property: city at org.hibernate.persister.entity.AbstractPropertyMapping.getColumnNames(AbstractPropertyMapping.java:89) at org.hibernate.persister.entity.AbstractEntityPersister.getPropertyColumnNames(AbstractEntityPersister.java:1982) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jPropertyHelper.getColumnName(Neo4jPropertyHelper.java:84) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jPropertyHelper.getColumnName(Neo4jPropertyHelper.java:75) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.predicate.impl.Neo4jPredicateFactory.columnName(Neo4jPredicateFactory.java:109) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.predicate.impl.Neo4jPredicateFactory.getComparisonPredicate(Neo4jPredicateFactory.java:49) at org.hibernate.hql.ast.spi.SingleEntityQueryBuilder.addComparisonPredicate(SingleEntityQueryBuilder.java:87) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jQueryRendererDelegate.addComparisonPredicate(Neo4jQueryRendererDelegate.java:185) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jQueryRendererDelegate.predicateEquals(Neo4jQueryRendererDelegate.java:163) at org.hibernate.hql.ast.render.QueryRenderer.predicate(QueryRenderer.java:5197) at org.hibernate.hql.ast.render.QueryRenderer.searchCondition(QueryRenderer.java:4871) at org.hibernate.hql.ast.render.QueryRenderer.whereClause(QueryRenderer.java:2347) at org.hibernate.hql.ast.render.QueryRenderer.querySpec(QueryRenderer.java:2202) at org.hibernate.hql.ast.render.QueryRenderer.queryExpression(QueryRenderer.java:2105) at org.hibernate.hql.ast.render.QueryRenderer.queryStatement(QueryRenderer.java:1744) at org.hibernate.hql.ast.render.QueryRenderer.queryStatementSet(QueryRenderer.java:1657) at org.hibernate.hql.ast.render.QueryRenderer.statement(QueryRenderer.java:653) at org.hibernate.hql.ast.spi.QueryRendererProcessor.process(QueryRendererProcessor.java:51) at org.hibernate.hql.QueryParser.parseQuery(QueryParser.java:82) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jBasedQueryParserService.parseQuery(Neo4jBasedQueryParserService.java:40) at org.hibernate.ogm.query.impl.OgmQueryTranslator.getLoader(OgmQueryTranslator.java:131) at org.hibernate.ogm.query.impl.OgmQueryTranslator.doCompile(OgmQueryTranslator.java:120) at org.hibernate.ogm.query.impl.LegacyParserBridgeQueryTranslator.compile(LegacyParserBridgeQueryTranslator.java:55) 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.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800) at org.hibernate.engine.spi.SessionDelegatorBaseImpl.createQuery(SessionDelegatorBaseImpl.java:401) at org.hibernate.ogm.jpa.impl.OgmEntityManager.createQuery(OgmEntityManager.java:209) at by.defascathibernate.ogm.test.BasicTest.lambda$test5FindJPQL$0(BasicTest.java:67) at by.defascathibernate.ogm.test.BasicTest$$Lambda$1/1168232535.accept(Unknown Source) at by.defascathibernate.ogm.test.BasicTest.doInTransaction(BasicTest.java:49) at by.defascathibernate.ogm.test.BasicTest.test5FindJPQL(BasicTest.java:64) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    Hibernate JIRA | 2 years ago | Andrey Panasyuk
    org.hibernate.MappingException: unknown property: city
  2. 0

    final Query jpqlQuery = em.createQuery("from UserProfile p where p.address.city = :city"); jpqlQuery.setParameter("city", "test"); Please find attached project to reproduce the issue. Neo4JTest can be used as an entry point Exception: org.hibernate.MappingException: unknown property: city at org.hibernate.persister.entity.AbstractPropertyMapping.getColumnNames(AbstractPropertyMapping.java:89) at org.hibernate.persister.entity.AbstractEntityPersister.getPropertyColumnNames(AbstractEntityPersister.java:1982) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jPropertyHelper.getColumnName(Neo4jPropertyHelper.java:84) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jPropertyHelper.getColumnName(Neo4jPropertyHelper.java:75) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.predicate.impl.Neo4jPredicateFactory.columnName(Neo4jPredicateFactory.java:109) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.predicate.impl.Neo4jPredicateFactory.getComparisonPredicate(Neo4jPredicateFactory.java:49) at org.hibernate.hql.ast.spi.SingleEntityQueryBuilder.addComparisonPredicate(SingleEntityQueryBuilder.java:87) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jQueryRendererDelegate.addComparisonPredicate(Neo4jQueryRendererDelegate.java:185) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jQueryRendererDelegate.predicateEquals(Neo4jQueryRendererDelegate.java:163) at org.hibernate.hql.ast.render.QueryRenderer.predicate(QueryRenderer.java:5197) at org.hibernate.hql.ast.render.QueryRenderer.searchCondition(QueryRenderer.java:4871) at org.hibernate.hql.ast.render.QueryRenderer.whereClause(QueryRenderer.java:2347) at org.hibernate.hql.ast.render.QueryRenderer.querySpec(QueryRenderer.java:2202) at org.hibernate.hql.ast.render.QueryRenderer.queryExpression(QueryRenderer.java:2105) at org.hibernate.hql.ast.render.QueryRenderer.queryStatement(QueryRenderer.java:1744) at org.hibernate.hql.ast.render.QueryRenderer.queryStatementSet(QueryRenderer.java:1657) at org.hibernate.hql.ast.render.QueryRenderer.statement(QueryRenderer.java:653) at org.hibernate.hql.ast.spi.QueryRendererProcessor.process(QueryRendererProcessor.java:51) at org.hibernate.hql.QueryParser.parseQuery(QueryParser.java:82) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jBasedQueryParserService.parseQuery(Neo4jBasedQueryParserService.java:40) at org.hibernate.ogm.query.impl.OgmQueryTranslator.getLoader(OgmQueryTranslator.java:131) at org.hibernate.ogm.query.impl.OgmQueryTranslator.doCompile(OgmQueryTranslator.java:120) at org.hibernate.ogm.query.impl.LegacyParserBridgeQueryTranslator.compile(LegacyParserBridgeQueryTranslator.java:55) 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.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800) at org.hibernate.engine.spi.SessionDelegatorBaseImpl.createQuery(SessionDelegatorBaseImpl.java:401) at org.hibernate.ogm.jpa.impl.OgmEntityManager.createQuery(OgmEntityManager.java:209) at by.defascathibernate.ogm.test.BasicTest.lambda$test5FindJPQL$0(BasicTest.java:67) at by.defascathibernate.ogm.test.BasicTest$$Lambda$1/1168232535.accept(Unknown Source) at by.defascathibernate.ogm.test.BasicTest.doInTransaction(BasicTest.java:49) at by.defascathibernate.ogm.test.BasicTest.test5FindJPQL(BasicTest.java:64) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    Hibernate JIRA | 2 years ago | Andrey Panasyuk
    org.hibernate.MappingException: unknown property: city

    Root Cause Analysis

    1. org.hibernate.MappingException

      unknown property: city

      at org.hibernate.persister.entity.AbstractPropertyMapping.getColumnNames()
    2. Hibernate
      AbstractEntityPersister.getPropertyColumnNames
      1. org.hibernate.persister.entity.AbstractPropertyMapping.getColumnNames(AbstractPropertyMapping.java:89)
      2. org.hibernate.persister.entity.AbstractEntityPersister.getPropertyColumnNames(AbstractEntityPersister.java:1982)
      2 frames
    3. org.hibernate.ogm
      Neo4jPredicateFactory.getComparisonPredicate
      1. org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jPropertyHelper.getColumnName(Neo4jPropertyHelper.java:84)
      2. org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jPropertyHelper.getColumnName(Neo4jPropertyHelper.java:75)
      3. org.hibernate.ogm.datastore.neo4j.query.parsing.impl.predicate.impl.Neo4jPredicateFactory.columnName(Neo4jPredicateFactory.java:109)
      4. org.hibernate.ogm.datastore.neo4j.query.parsing.impl.predicate.impl.Neo4jPredicateFactory.getComparisonPredicate(Neo4jPredicateFactory.java:49)
      4 frames
    4. Hibernate HQL/JP-QL Parser
      SingleEntityQueryBuilder.addComparisonPredicate
      1. org.hibernate.hql.ast.spi.SingleEntityQueryBuilder.addComparisonPredicate(SingleEntityQueryBuilder.java:87)
      1 frame
    5. org.hibernate.ogm
      Neo4jQueryRendererDelegate.predicateEquals
      1. org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jQueryRendererDelegate.addComparisonPredicate(Neo4jQueryRendererDelegate.java:185)
      2. org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jQueryRendererDelegate.predicateEquals(Neo4jQueryRendererDelegate.java:163)
      2 frames
    6. Hibernate HQL/JP-QL Parser
      QueryParser.parseQuery
      1. org.hibernate.hql.ast.render.QueryRenderer.predicate(QueryRenderer.java:5197)
      2. org.hibernate.hql.ast.render.QueryRenderer.searchCondition(QueryRenderer.java:4871)
      3. org.hibernate.hql.ast.render.QueryRenderer.whereClause(QueryRenderer.java:2347)
      4. org.hibernate.hql.ast.render.QueryRenderer.querySpec(QueryRenderer.java:2202)
      5. org.hibernate.hql.ast.render.QueryRenderer.queryExpression(QueryRenderer.java:2105)
      6. org.hibernate.hql.ast.render.QueryRenderer.queryStatement(QueryRenderer.java:1744)
      7. org.hibernate.hql.ast.render.QueryRenderer.queryStatementSet(QueryRenderer.java:1657)
      8. org.hibernate.hql.ast.render.QueryRenderer.statement(QueryRenderer.java:653)
      9. org.hibernate.hql.ast.spi.QueryRendererProcessor.process(QueryRendererProcessor.java:51)
      10. org.hibernate.hql.QueryParser.parseQuery(QueryParser.java:82)
      10 frames
    7. org.hibernate.ogm
      Neo4jBasedQueryParserService.parseQuery
      1. org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jBasedQueryParserService.parseQuery(Neo4jBasedQueryParserService.java:40)
      1 frame
    8. Hibernate Object Grid Mapper
      LegacyParserBridgeQueryTranslator.compile
      1. org.hibernate.ogm.query.impl.OgmQueryTranslator.getLoader(OgmQueryTranslator.java:131)
      2. org.hibernate.ogm.query.impl.OgmQueryTranslator.doCompile(OgmQueryTranslator.java:120)
      3. org.hibernate.ogm.query.impl.LegacyParserBridgeQueryTranslator.compile(LegacyParserBridgeQueryTranslator.java:55)
      3 frames
    9. Hibernate
      SessionDelegatorBaseImpl.createQuery
      1. org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131)
      2. org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93)
      3. org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167)
      4. org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
      5. org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
      6. org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800)
      7. org.hibernate.engine.spi.SessionDelegatorBaseImpl.createQuery(SessionDelegatorBaseImpl.java:401)
      7 frames
    10. Hibernate Object Grid Mapper
      OgmEntityManager.createQuery
      1. org.hibernate.ogm.jpa.impl.OgmEntityManager.createQuery(OgmEntityManager.java:209)
      1 frame
    11. by.defascathibernate.ogm
      BasicTest.lambda$test5FindJPQL$0
      1. by.defascathibernate.ogm.test.BasicTest.lambda$test5FindJPQL$0(BasicTest.java:67)
      1 frame