yuri_ev 8 de jun. de 2011
Talvez não me expressei bem, mas se rodar esse sql no oracle ele funciona. O problema foi na “tradução” do sql pro hql que não funcionou.
yuri_ev 8 de jun. de 2011
org . hibernate . QueryException : unexpected token : ( [ select nvl ( x . qtde , 0 ), l . nome from br . com . admin . model . Laboratorio as l , ( select count ( * ) as qtde , laudo . id from br . com . admin . model . Laudo as laudo group by laudo . id ) as x where x . xid ( + ) = l . id and l . id not in ( 10 , 24 ) order by l . nome ]
at org . hibernate . hql . classic . FromParser . token ( FromParser . java : 140 )
at org . hibernate . hql . classic . ClauseParser . token ( ClauseParser . java : 109 )
at org . hibernate . hql . classic . PreprocessingParser . token ( PreprocessingParser . java : 131 )
at org . hibernate . hql . classic . ParserHelper . parse ( ParserHelper . java : 51 )
at org . hibernate . hql . classic . QueryTranslatorImpl . compile ( QueryTranslatorImpl . java : 240 )
at org . hibernate . hql . classic . QueryTranslatorImpl . compile ( QueryTranslatorImpl . java : 209 )
at org . hibernate . engine . query . HQLQueryPlan .( HQLQueryPlan . java : 101 )
at org . hibernate . engine . query . HQLQueryPlan .( HQLQueryPlan . java : 80 )
at org . hibernate . engine . query . QueryPlanCache . getHQLQueryPlan ( QueryPlanCache . java : 124 )
at org . hibernate . impl . AbstractSessionImpl . getHQLQueryPlan ( AbstractSessionImpl . java : 156 )
at org . hibernate . impl . AbstractSessionImpl . createQuery ( AbstractSessionImpl . java : 135 )
at org . hibernate . impl . SessionImpl . createQuery ( SessionImpl . java : 1770 )
at sun . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method )
at sun . reflect . NativeMethodAccessorImpl . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at org . hibernate . context . ThreadLocalSessionContext $ TransactionProtectionWrapper . invoke ( ThreadLocalSessionContext . java : 345 )
at $ Proxy29 . createQuery ( Unknown Source )
at br . com . admin . dao . LaudoDAO . bucaTotalLaudosPorLaboratorios ( LaudoDAO . java : 235 )
at br . com . admin . controller . LaudoController . totalLaudosLaboratorios ( LaudoController . java : 121 )
at sun . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method )
at sun . reflect . NativeMethodAccessorImpl . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at br . com . caelum . vraptor . interceptor . ExecuteMethodInterceptor . intercept ( ExecuteMethodInterceptor . java : 61 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . core . LazyInterceptorHandler . execute ( LazyInterceptorHandler . java : 61 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . admin . interceptor . AuthenticationInterceptor . intercept ( AuthenticationInterceptor . java : 177 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . interceptor . InstantiateInterceptor . intercept ( InstantiateInterceptor . java : 48 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . interceptor . ParametersInstantiatorInterceptor . intercept ( ParametersInstantiatorInterceptor . java : 89 )
at br . com . caelum . vraptor . core . LazyInterceptorHandler . execute ( LazyInterceptorHandler . java : 59 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . interceptor . FlashInterceptor . intercept ( FlashInterceptor . java : 83 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . interceptor . ExceptionHandlerInterceptor . intercept ( ExceptionHandlerInterceptor . java : 71 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . interceptor . ResourceLookupInterceptor . intercept ( ResourceLookupInterceptor . java : 69 )
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 )
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 )
at br . com . caelum . vraptor . core . EnhancedRequestExecution . execute ( EnhancedRequestExecution . java : 23 )
at br . com . caelum . vraptor . VRaptor $ 1 . insideRequest ( VRaptor . java : 92 )
at br . com . caelum . vraptor . ioc . spring . SpringProvider . provideForRequest ( SpringProvider . java : 58 )
at br . com . caelum . vraptor . VRaptor . doFilter ( VRaptor . java : 89 )
at org . mortbay . jetty . servlet . ServletHandler $ CachedChain . doFilter ( ServletHandler . java : 1148 )
at br . com . admin . filter . ConexaoFilter . doFilter ( ConexaoFilter . java : 62 )
at org . mortbay . jetty . servlet . ServletHandler $ CachedChain . doFilter ( ServletHandler . java : 1148 )
at br . com . admin . filter . HibernateSessionRequestFilter . doFilter ( HibernateSessionRequestFilter . java : 64 )
at org . mortbay . jetty . servlet . ServletHandler $ CachedChain . doFilter ( ServletHandler . java : 1148 )
at org . mortbay . jetty . servlet . ServletHandler . handle ( ServletHandler . java : 387 )
at org . mortbay . jetty . security . SecurityHandler . handle ( SecurityHandler . java : 216 )
at org . mortbay . jetty . servlet . SessionHandler . handle ( SessionHandler . java : 181 )
at org . mortbay . jetty . handler . ContextHandler . handle ( ContextHandler . java : 765 )
at org . mortbay . jetty . webapp . WebAppContext . handle ( WebAppContext . java : 417 )
at org . mortbay . jetty . handler . HandlerWrapper . handle ( HandlerWrapper . java : 152 )
at org . mortbay . jetty . Server . handle ( Server . java : 326 )
at org . mortbay . jetty . HttpConnection . handleRequest ( HttpConnection . java : 534 )
at org . mortbay . jetty . HttpConnection $ RequestHandler . content ( HttpConnection . java : 879 )
at org . mortbay . jetty . HttpParser . parseNext ( HttpParser . java : 747 )
at org . mortbay . jetty . HttpParser . parseAvailable ( HttpParser . java : 218 )
at org . mortbay . jetty . HttpConnection . handle ( HttpConnection . java : 404 )
at org . mortbay . jetty . bio . SocketConnector $ Connection . run ( SocketConnector . java : 228 )
at org . mortbay . jetty . security . SslSocketConnector $ SslConnection . run ( SslSocketConnector . java : 636 )
at org . mortbay . thread . QueuedThreadPool $ PoolThread . run ( QueuedThreadPool . java : 520 )
yuri_ev 8 de jun. de 2011
É… hql não suporta subqueries no from