cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rafael López Torres <rafael.lopez.tor...@juntadeandalucia.es>
Subject spatial operations with selectQuery
Date Tue, 29 Jan 2013 09:54:08 GMT
Hi,
I need some help with spatial operations in cayenne.
How can i do spatial operations with SelectQuery?

With SQLTemplate, no problem, but prefetching not working for me, and
performance is very bad.
The next code  is for SQLTemplate prefetch:

SQLTemplate sqlQuery = new SQLTemplate(
                    Recinto.class,
                    "SELECT "
                            + "#result('t1.ID_RECINTO_ALFANUM' 'Long' ''
'toRecintoAlfanum.ID_RECINTO_ALFANUM'), "                           
                            + "#result('t2.ID_RECINTO_GEOM' 'Long' ''
'toRecintoGeom.ID_RECINTO_GEOM'), "
                            + "#result('t2.SD_GEOM'
'com.vividsolutions.jts.geom.Geometry' ) "
                            + "FROM SGPCD_RECINTOS t0,
SGPCD_RECINTOS_ALFNUM t1, SGPCD_RECINTOS_GEOM t2 "
                            + "WHERE t0.ID_RECINTO_ALFANUM =
t1.ID_RECINTO_ALFANUM AND "
                            + " t0.ID_RECINTO_GEOM = t2.ID_RECINTO_GEOM
AND "
                            + "t0.IU_IL_RECINTO=23747616");
           
           
            sqlQuery.addPrefetch("toRecintoAlfanum");

But the following error is displayed:
-----------------trace begin
org.apache.cayenne.reflect.PropertyException: [v.3.0.2 Jun 11 2011
09:26:09] Error reading DataObject property: toRecintoGeom
    at
org.apache.cayenne.reflect.generic.DataObjectBaseProperty.readPropertyDirectly(DataObjectBaseProperty.java:71)
    at
org.apache.cayenne.access.PrefetchProcessorNode.clearNullRelationships(PrefetchProcessorNode.java:140)
    at
org.apache.cayenne.access.PrefetchProcessorNode.connectToParents(PrefetchProcessorNode.java:130)
    at
org.apache.cayenne.access.HierarchicalObjectResolver$PostProcessor.startJointPrefetch(HierarchicalObjectResolver.java:295)
    at
org.apache.cayenne.query.PrefetchTreeNode.traverse(PrefetchTreeNode.java:170)
    at
org.apache.cayenne.query.PrefetchTreeNode.traverse(PrefetchTreeNode.java:179)
    at
org.apache.cayenne.access.HierarchicalObjectResolver.resolveObjectTree(HierarchicalObjectResolver.java:94)
    at
org.apache.cayenne.access.HierarchicalObjectResolver.synchronizedRootResultNodeFromDataRows(HierarchicalObjectResolver.java:72)
    at
org.apache.cayenne.access.DataDomainQueryAction$ObjectConversionStrategy.toResultsTree(DataDomainQueryAction.java:579)
    at
org.apache.cayenne.access.DataDomainQueryAction$SingleObjectConversionStrategy.convert(DataDomainQueryAction.java:625)
    at
org.apache.cayenne.access.DataDomainQueryAction.interceptObjectConversion(DataDomainQueryAction.java:455)
    at
org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:129)
    at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:743)
    at
org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:334)
    at
org.apache.cayenne.util.ObjectContextQueryAction.executePostCache(ObjectContextQueryAction.java:104)
    at
org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:91)
    at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1293)
    at
org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1282)
    at
es.juntadeandalucia.agapa.gis.ide.cad.persistence.GeoEntityGenericDAOImpl.restore(GeoEntityGenericDAOImpl.java:224)
    at
es.juntadeandalucia.agapa.gis.ide.cad.control.GeoEntityControlImpl.load(GeoEntityControlImpl.java:185)
    at
es.juntadeandalucia.agapa.gis.ide.cad.rest.GeoEntityResource.getGeoEntity(GeoEntityResource.java:149)
    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
com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    at
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
    at
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    at
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
    at
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    at
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1480)
    at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1411)
    at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1360)
    at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1350)
    at
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
    at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
    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
org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)
    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.cayenne.reflect.generic.DataObjectBaseProperty.readPropertyDirectly(DataObjectBaseProperty.java:68)
-----------------trace end

Can anybody help me, please
Thank a log.

P.D.: sorry my bad english. I hope you understand my question/problem

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message