org.hibernate.QueryException: Unable to resolve path [a.uid]

Description

I'm using hibernate persistence.xml-

Why the hibernate is not creating alias a in the generated sql? Please let me know how to fix this issue.

17:27:13,154 ERROR [STDERR] java.lang.IllegalArgumentException: org.hibernate.QueryException: Unable to resolve path [a.uid], unexpected token [a] [select count(a) from com.tetratech.edas2.model.TrophicLevel where a.uid <> :uid and a.name = :name and a.code = :code]
17:27:13,155 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:616)
17:27:13,155 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:95)
17:27:13,155 ERROR [STDERR] at org.jboss.seam.persistence.EntityManagerProxy.createQuery(EntityManagerProxy.java:81)
17:27:13,155 ERROR [STDERR] at com.tetratech.edas2.session.TrophicLevelEditor.isItemUnique(TrophicLevelEditor.java:169)
17:27:13,155 ERROR [STDERR] at com.tetratech.edas2.session.TrophicLevelEditor.isItemUnique(TrophicLevelEditor.java:49)
17:27:13,155 ERROR [STDERR] at com.tetratech.edas2.session.DataGridEditor.addItem(DataGridEditor.java:156)
17:27:13,155 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:27:13,155 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
17:27:13,155 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
17:27:13,155 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:616)
17:27:13,155 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
17:27:13,155 ERROR [STDERR] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
17:27:13,155 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
17:27:13,155 ERROR [STDERR] at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
17:27:13,155 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
17:27:13,155 ERROR [STDERR] at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
17:27:13,155 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
17:27:13,155 ERROR [STDERR] at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:65)
17:27:13,155 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
17:27:13,155 ERROR [STDERR] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
17:27:13,156 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
17:27:13,156 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
17:27:13,156 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
17:27:13,156 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
17:27:13,156 ERROR [STDERR] at com.tetratech.edas2.session.TrophicLevelEditor_$$javassist_seam_7.addItem(TrophicLevelEditor$$_javassist_seam_7.java)
17:27:13,156 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:27:13,156 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
17:27:13,156 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
17:27:13,156 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:616)
17:27:13,156 ERROR [STDERR] at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
17:27:13,156 ERROR [STDERR] at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:280)
17:27:13,156 ERROR [STDERR] at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
17:27:13,156 ERROR [STDERR] at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
17:27:13,156 ERROR [STDERR] at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
17:27:13,156 ERROR [STDERR] at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
17:27:13,156 ERROR [STDERR] at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
17:27:13,156 ERROR [STDERR] at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
17:27:13,156 ERROR [STDERR] at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
17:27:13,156 ERROR [STDERR] at javax.faces.component.UICommand.broadcast(UICommand.java:383)
17:27:13,156 ERROR [STDERR] at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
17:27:13,156 ERROR [STDERR] at org.ajax4jsf.component.UIDataAdaptor.broadcast(UIDataAdaptor.java:1364)
17:27:13,156 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
17:27:13,156 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
17:27:13,157 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
17:27:13,157 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
17:27:13,157 ERROR [STDERR] at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
17:27:13,157 ERROR [STDERR] at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
17:27:13,157 ERROR [STDERR] at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
17:27:13,157 ERROR [STDERR] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
17:27:13,157 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
17:27:13,157 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:27:13,157 ERROR [STDERR] at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:164)
17:27:13,157 ERROR [STDERR] at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
17:27:13,157 ERROR [STDERR] at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
17:27:13,157 ERROR [STDERR] at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:406)
17:27:13,157 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
17:27:13,157 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:27:13,157 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
17:27:13,164 ERROR [STDERR] at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
17:27:13,164 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
17:27:13,164 ERROR [STDERR] at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
17:27:13,164 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
17:27:13,164 ERROR [STDERR] at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
17:27:13,164 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
17:27:13,164 ERROR [STDERR] at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
17:27:13,164 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
17:27:13,164 ERROR [STDERR] at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
17:27:13,164 ERROR [STDERR] at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
17:27:13,164 ERROR [STDERR] at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
17:27:13,164 ERROR [STDERR] at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
17:27:13,164 ERROR [STDERR] at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
17:27:13,164 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
17:27:13,165 ERROR [STDERR] at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
17:27:13,165 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
17:27:13,165 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
17:27:13,165 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
17:27:13,165 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:27:13,165 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
17:27:13,165 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
17:27:13,165 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:27:13,165 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
17:27:13,165 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
17:27:13,165 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
17:27:13,165 ERROR [STDERR] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
17:27:13,165 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
17:27:13,165 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
17:27:13,165 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
17:27:13,165 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
17:27:13,165 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
17:27:13,165 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
17:27:13,165 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
17:27:13,165 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
17:27:13,165 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
17:27:13,165 ERROR [STDERR] at java.lang.Thread.run(Thread.java:679)
17:27:13,166 ERROR [STDERR] Caused by: org.hibernate.QueryException: Unable to resolve path [a.uid], unexpected token [a] [select count(a) from com.tetratech.edas2.model.TrophicLevel where a.uid <> :uid and a.name = :name and a.code = :code]
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.ast.tree.IdentNode.resolveAsNakedComponentPropertyRefLHS(IdentNode.java:196)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.ast.tree.IdentNode.resolve(IdentNode.java:85)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.ast.tree.DotNode.resolveFirstChild(DotNode.java:153)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:460)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.antlr.HqlSqlBaseWalker.addrExpr(HqlSqlBaseWalker.java:4326)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1212)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4041)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3549)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1762)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1687)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1687)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
17:27:13,167 ERROR [STDERR] at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
17:27:13,167 ERROR [STDERR] at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
17:27:13,167 ERROR [STDERR] at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
17:27:13,167 ERROR [STDERR] at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
17:27:13,167 ERROR [STDERR] at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
17:27:13,168 ERROR [STDERR] at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
17:27:13,168 ERROR [STDERR] at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
17:27:13,168 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:92)
17:27:13,168 ERROR [STDERR] ... 92 more
17:27:13,176 INFO [TrophicLevelEditor] preparing results

<persistence-unit name="edas2" transaction-type="JTA">^M
<provider>org.hibernate.ejb.HibernatePersistence</provider>^M
<jta-data-source>java:/edas2Datasource</jta-data-source>^M
<properties>^M
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>^M
<property name="hibernate.hbm2ddl.auto" value="create-update"/>^M
<property name="hibernate.jdbc.batch_size" value="20"/>^M
<property name="hibernate.use_sql_comments" value="true"/>^M
<property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/>^M
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>^M
</properties>^M
</persistence-unit>^M

Environment

JBoss 4.2.2 GA

Activity

Show:
Brett Meyer
October 29, 2013, 12:20 PM

These types of questions are best asked starting in the user forums. JIRA is only for concise issues (with a test case) or new features. Thanks!

Assignee

Unassigned

Reporter

RS

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Critical
Configure