Hi all,
I want to write anonymous view in HQL but facing the following error. Can anyone tell me how to write it in HQL.
Following are the details:
Application Server: JBoss 4.0.3
Hibernate version: 3.0
HQL: from com.salesgene.common.bean.hibernate.ProspectCustomField as prospectCustomField left join fetch prospectCustomField.userInterfaceType left join fetch prospectCustomField.fieldType left join fetch prospectCustomField.prospectFieldAllowedValues left join fetch ( select pcfv from com.salesgene.common.bean.hibernate.ProspectCustomFieldValue pcfv where pcfv.prospect.prospectId = :intProspectId ) where prospectCustomField.prospectCustomFieldGroup.prosCustFieldGroupId = :intProspectCustomFieldGroupId order by prospectCustomField.sequence
Full stack trace of any exception that occurs: 11:46:35,046 ERROR [PARSER] *** ERROR: line 1:264: expecting IDENT, found '(' 11:46:35,046 ERROR [PARSER] *** ERROR: line 1:274: unexpected token: pcfv 11:46:35,046 ERROR [STDERR] org.hibernate.hql.ast.QuerySyntaxError: expecting IDENT, found '(' near line 1, column 264 [from com.salesgene.common.bean.hibernate.ProspectCustomField as prospectCustomField left join fetch prospectCustomField.userInterfaceType left join fetch prospectCustomField.fieldType left join fetch prospectCustomField.prospectFieldAllowedValues left join fetch ( select pcfv from com.salesgene.common.bean.hibernate.ProspectCustomFieldValue pcfv where pcfv.prospect.prospectId = :intProspectId ) where prospectCustomField.prospectCustomFieldGroup.prosCustFieldGroupId = :intProspectCustomFieldGroupId order by prospectCustomField.sequence] at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63) at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:215) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83) at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427) at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) at com.salesgene.common.utils.DBUtility.executeUniqueH3Query(DBUtility.java:388) at com.salesgene.dao.prospect.ProspectDAO.getProspectCustomFieldList(ProspectDAO.java:1672) at com.salesgene.ejb.prospect.ProspectSessionBean.getProspectCustomFieldList(ProspectSessionBean.java:4374) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.invocation.Invocation.performCall(Invocation.java:359) at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158) at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121) at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:173) at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:77) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136) at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648) at org.jboss.ejb.Container.invoke(Container.java:954) at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:430) at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:103) at $Proxy242.getProspectCustomFieldList(Unknown Source) at com.salesgene.controller.prospect.ProspectController.getProspectCustomFieldList(ProspectController.java:10512) at com.salesgene.servlets.prospect.ProspectServlet.doGet(ProspectServlet.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:697) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.salesgene.common.filters.UserSessionFilter.doProcessing(UserSessionFilter.java:311) at com.salesgene.common.filters.UserSessionFilter.doFilter(UserSessionFilter.java:178) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) Caused by: line 1:264: expecting IDENT, found '(' at antlr.Parser.match(Parser.java:211) at org.hibernate.hql.antlr.HqlBaseParser.identifier(HqlBaseParser.java:461) at org.hibernate.hql.antlr.HqlBaseParser.path(HqlBaseParser.java:574) at org.hibernate.hql.antlr.HqlBaseParser.fromJoin(HqlBaseParser.java:1322) at org.hibernate.hql.antlr.HqlBaseParser.fromClause(HqlBaseParser.java:1053) at org.hibernate.hql.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:759) at org.hibernate.hql.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:611) at org.hibernate.hql.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:263) at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:150) at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:209) ... 56 more 11:46:35,109 INFO [UIMessage] Error code is 13002 11:46:35,109 INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@2e46eb java.lang.Throwable: STACKTRACE at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:290) at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:417) at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842) at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88) at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:298) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:110) at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:137) at org.hibernate.impl.SessionImpl.connection(SessionImpl.java:345) at com.salesgene.common.utils.DBUtility.setAccessLevel(DBUtility.java:219) at com.salesgene.common.utils.DBUtility.getDBSession(DBUtility.java:107) at com.salesgene.ejb.prospect.ProspectSessionBean.getProspectCustomFieldList(ProspectSessionBean.java:4363) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.invocation.Invocation.performCall(Invocation.java:359) at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158) at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121) at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:173) at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:77) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136) at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648) at org.jboss.ejb.Container.invoke(Container.java:954) at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:430) at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:103) at $Proxy242.getProspectCustomFieldList(Unknown Source) at com.salesgene.controller.prospect.ProspectController.getProspectCustomFieldList(ProspectController.java:10512) at com.salesgene.servlets.prospect.ProspectServlet.doGet(ProspectServlet.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:697) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.salesgene.common.filters.UserSessionFilter.doProcessing(UserSessionFilter.java:311) at com.salesgene.common.filters.UserSessionFilter.doFilter(UserSessionFilter.java:178) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) 11:46:35,109 ERROR [LogInterceptor] RuntimeException in method: public abstract java.util.Vector com.salesgene.ejb.prospect.ProspectSession.getProspectCustomFieldList(int,com.salesgene.common.bean.lookup.SGUserProfile) throws com.salesgene.common.exceptions.SGSysException: java.lang.NullPointerException at com.salesgene.common.exceptions.UIMessage.getUserMessage(UIMessage.java:143) at com.salesgene.common.exceptions.SGException.<init>(SGException.java:159) at com.salesgene.common.exceptions.SGException.<init>(SGException.java:147) at com.salesgene.common.exceptions.SGSysException.<init>(SGSysException.java:66) at com.salesgene.ejb.prospect.ProspectSessionBean.getProspectCustomFieldList(ProspectSessionBean.java:4379) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.invocation.Invocation.performCall(Invocation.java:359) at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158) at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121) at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:173) at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:77) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136) at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648) at org.jboss.ejb.Container.invoke(Container.java:954) at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:430) at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:103) at $Proxy242.getProspectCustomFieldList(Unknown Source) at com.salesgene.controller.prospect.ProspectController.getProspectCustomFieldList(ProspectController.java:10512) at com.salesgene.servlets.prospect.ProspectServlet.doGet(ProspectServlet.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:697) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.salesgene.common.filters.UserSessionFilter.doProcessing(UserSessionFilter.java:311) at com.salesgene.common.filters.UserSessionFilter.doFilter(UserSessionFilter.java:178) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) 11:46:35,140 ERROR [[ProspectServlet]] Servlet.service() for servlet ProspectServlet threw exception java.lang.NullPointerException at com.salesgene.servlets.prospect.ProspectServlet.makeCustomFieldsXML(ProspectServlet.java:86) at com.salesgene.servlets.prospect.ProspectServlet.doGet(ProspectServlet.java:65) at javax.servlet.http.HttpServlet.service(HttpServlet.java:697) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.salesgene.common.filters.UserSessionFilter.doProcessing(UserSessionFilter.java:311) at com.salesgene.common.filters.UserSessionFilter.doFilter(UserSessionFilter.java:178) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) 11:46:47,828 WARN [ConnectionManager] finalizing with closed connection
Name and version of the database I am using:Oracle 10g
_________________ Zia Ur Rahman Baig
Senior Software Engineer
i2c inc.
+92-300-4284205
|