title: org.hibernate.Query could not resolve property when the property is there [Hibernate JPA]
body: <p>I want to load patients that are smokers and have been diagnosed with a heart beat higher that 120. I keep getting this error org.hibernate.Query could not resolve property smoking. If I change the property for something else f.e. id I get the same error. I have tried different querys with the same result. All entitys are in separate files. What is wrong with my code?</p>
  
  <p>query:</p>
  
  <pre><code>Query q = em.createQuery("select p from Patient p join p.visits v join v.data d WHERE d.smoking　= 'yes' and d.heartrate &gt; 120");
  </code></pre>
  
  <p>code:</p>
  
  <pre><code>import javax.persistence.Query;
  [...]
  
  @Entity
  public class Patient extends Person implements Serializable {
       private static final long serialVersionUID = 1L;
       private int id;
       @OneToMany
       private List&lt;Visit&gt; visits = new ArrayList&lt;&gt;();
  [...]
  }
  @Entity
  public class Visit implements Serializable {
       private static final long serialVersionUID = 1L;
       private int id;
       @OneToOne
       private Data data;
  [...]
  }
  @Entity
  public class Data implements Serializable {
       private static final long serialVersionUID = 1L;
       private int id;
       private String smoking;
       private int heartrate;
  [...]
  }
  </code></pre>
  
  <p>stack trace:</p>
  
  <pre><code>java.lang.IllegalArgumentException: org.hibernate.QueryException: could not resolve property: palacy　 of: odwzorowania.Wywiad [select p from odwzorowania.Pacjent p join p.wizyty w join w.wywiad wy WHERE wy.palacy　= 'tak' AND wy.tetno &gt; 120]
  at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:624)
  at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:96)
  at ntbd.Przychodnia.jButtonZnajdzPacjentowTetnoActionPerformed(Przychodnia.java:904)
  at ntbd.Przychodnia.access$1100(Przychodnia.java:23)
  at ntbd.Przychodnia$18.actionPerformed(Przychodnia.java:682)
  at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
  at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
  at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
  at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
  at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
  at java.awt.Component.processMouseEvent(Component.java:6505)
  at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
  at java.awt.Component.processEvent(Component.java:6270)
  at java.awt.Container.processEvent(Container.java:2229)
  at java.awt.Component.dispatchEventImpl(Component.java:4861)
  at java.awt.Container.dispatchEventImpl(Container.java:2287)
  at java.awt.Component.dispatchEvent(Component.java:4687)
  at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
  at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
  at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
  at java.awt.Container.dispatchEventImpl(Container.java:2273)
  at java.awt.Window.dispatchEventImpl(Window.java:2713)
  at java.awt.Component.dispatchEvent(Component.java:4687)
  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
  at java.awt.EventQueue.access$000(EventQueue.java:101)
  at java.awt.EventQueue$3.run(EventQueue.java:666)
  at java.awt.EventQueue$3.run(EventQueue.java:664)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
  at java.awt.EventQueue$4.run(EventQueue.java:680)
  at java.awt.EventQueue$4.run(EventQueue.java:678)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
  at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
  Caused by: org.hibernate.QueryException: could not resolve property: palacy　 of: odwzorowania.Wywiad [select p from odwzorowania.Pacjent p join p.wizyty w join w.wywiad wy WHERE wy.palacy　= 'tak' AND wy.tetno &gt; 120]
      at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:44)
      at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:38)
      at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1358)
      at org.hibernate.hql.ast.tree.FromElementType.getPropertyType(FromElementType.java:279)
      at org.hibernate.hql.ast.tree.FromElement.getPropertyType(FromElement.java:386)
      at org.hibernate.hql.ast.tree.DotNode.getDataType(DotNode.java:566)
      at org.hibernate.hql.ast.tree.DotNode.prepareLhs(DotNode.java:241)
      at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:188)
      at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:94)
      at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:90)
      at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:728)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1216)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4041)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3525)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1762)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1687)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
      at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
      at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
      at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
      at org.hibernate.engine.query.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:77)
      at org.hibernate.engine.query.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:56)
      at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
      at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
      at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
      at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
      at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:93)
      ... 39 more
  </code></pre>