openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chaos907 <da...@edelements.com>
Subject Native SQL Query
Date Thu, 02 Jun 2011 21:21:52 GMT
Hi, I am trying to run a native select sql query on openJPA 2.1, MySQL 5.5.
When I tried to run the following code, it throws the exception below. From
what I can tell, the error is being thrown because there is no
ExpressionParser for the SQL Language, but I have no idea why the parser is
null or how to make sure it's not null. If anyone has any idea how to fix
this, it would be most appreciated. 

Code being ran: 

        Query query = entityManager.createNativeQuery(sqlquery); 
        List&lt;Object[]&gt; results = query.getResultList(); 

Stack trace: 

<openjpa-2.1.0-r422266:1071316 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: null 
        at
org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:625) 
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:852) 
        at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794) 
        at
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542) 
        at
org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:305) 
        at
org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:319) 
        at
com.edelements.platform.dao.impl.CustomReportsDAOImpl.runQuery(CustomReportsDAOImpl.java:37)

        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:597) 
        at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)

        at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

        at
org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)

        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)

        at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)

        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

        at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) 
        at $Proxy71.runQuery(Unknown Source) 
        at
com.edelements.platform.service.impl.CustomReportsServiceImpl.generateReport(CustomReportsServiceImpl.java:66)

        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:597) 
        at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)

        at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

        at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)

        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)

        at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)

        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

        at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) 
        at $Proxy72.generateReport(Unknown Source) 
        at
com.edelements.platform.servlets.CustomReportsServlet.doPost(CustomReportsServlet.java:47)

        at
com.edelements.platform.servlets.CustomReportsServlet.doGet(CustomReportsServlet.java:32)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        at
com.edelements.platform.web.filter.RestMethodFilter.doFilter(RestMethodFilter.java:79) 
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        at
org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:359)

        at
org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:275) 
        at
org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) 
        at
org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) 
        at
org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:344) 
        at
org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:272)

        at
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:81) 
        at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)

        at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) 
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) 
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)

        at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 
        at java.lang.Thread.run(Thread.java:662) 
Caused by: java.lang.NullPointerException 
        at
org.apache.openjpa.kernel.ExpressionStoreQuery.newCompilation(ExpressionStoreQuery.java:154)

        at
org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:672) 
        at
org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:640) 
        at
org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:620) 
        ... 63 more

--
View this message in context: http://openjpa.208410.n2.nabble.com/Native-SQL-Query-tp6432918p6432918.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message