无法在jpql查询中获得结果,我的结果查询大小为0,
List<Exercise> prevexercise= (List<Exercise>)em.createQuery("Select e from Exercise e where e.activity = '"+exercise.getActivity()+"' AND e.GOAL_ID = '"+goal.getId()+"'").getResultList();
我不知道上面的查询有什么问题请帮我解决这个问题我是新手,如下所示
un 04,2015 5:16:56 PM org.apache.catalina.core.StandardWrapperValve invoke 严重:servlet [fitTrackerServlet]的Servlet.service()在路径[/ FitnessTracker]的上下文中引发异常[请求处理失败;嵌套异常是java.lang.IllegalArgumentException:org.hibernate.QueryException:无法解析属性:GOAL_ID:com.pluralsight.model.Exercise [从com.pluralsight.model.Exercise e中选择e,其中e.activity =&#39 ;运行&#39;和e.GOAL_ID =&#39; 1&#39;]]有根本原因 org.hibernate.QueryException:无法解析属性:GOAL_ID:com.pluralsight.model.Exercise [从com.pluralsight.model.Exercise e中选择e,其中e.activity =&#39;运行&#39;和e.GOAL_ID =&#39; 1&#39;] 在org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:83) 在org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:77) at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1928) 在org.hibernate.hql.internal.ast.tree.FromElementType.getPropertyType(FromElementType.java:313) at org.hibernate.hql.internal.ast.tree.FromElement.getPropertyType(FromElement.java:494)